在 EC2 实例SSM Agent上手动安装和卸载 Windows Server - Amazon Systems Manager
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

在 EC2 实例SSM Agent上手动安装和卸载 Windows Server

Amazon Systems Manager 默认情况下,Agent (SSM Agent) 预安装在以下 Amazon Machine Images (AMIs) 上,由亚马逊Windows Server提供:

  • 2016 年 11 月或以后发布的 Windows Server 2008-2012 R2 AMIs

  • Windows Server 2016、2019 和 2022

SSM Agent在 EC2 实例上安装用于 Windows Server

如有必要,可以使用以下过程在 Amazon Elastic Compute Cloud (Amazon EC2) 实例 Windows Server 上手动下载并安装最新版本的 SSM Agent。此过程中提供的命令也可以通过用户数据作为脚本传递给 Amazon EC2 实例。

SSM Agent需要 Windows PowerShell 3.0 或更高版本才能在Windows Server实例(例如,旧版文档)上运行某些 Amazon Systems Manager 文档(SSM AWS-ApplyPatchBaseline 文档)。验证您的 Windows Server 实例是否在 Windows Management Framework 3.0 或更高版本上运行。该框架包括 Windows PowerShell。有关更多信息,请参阅 Windows 管理框架 3.0

注意

此过程适用于在 Windows Server 的 EC2 实例上安装或重新安装 SSM Agent。如果需要在本地服务器或虚拟机 (VM) 上安装代理以与 Systems Manager 配合使用,请参阅安装适用于混合环境 (Windows) 的 SSM Agent

在 Windows Server 的 EC2 实例上手动安装最新版本的 SSM Agent
  1. 使用远程桌面或 Windows 连接到您的实例 PowerShell。有关更多信息,请参阅《适用于 Windows 实例的 Amazon EC2 用户指南》中的连接到您的实例

  2. 将最新版本的 SSM Agent下载到您的实例。您可以使用 PowerShell 命令或直接下载链接进行下载。

    PowerShell

    按顺序运行以下三个 PowerShell 命令。可通过这些命令下载 SSM Agent,无需调整 Internet Explorer (IE) 增强的安全设置,然后安装代理并移除安装文件。

    64-bit
    [System.Net.ServicePointManager]::SecurityProtocol = 'TLS12' $progressPreference = 'silentlyContinue' Invoke-WebRequest ` https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/windows_amd64/AmazonSSMAgentSetup.exe ` -OutFile $env:USERPROFILE\Desktop\SSMAgent_latest.exe
    32-bit
    [System.Net.ServicePointManager]::SecurityProtocol = 'TLS12' $progressPreference = 'silentlyContinue' Invoke-WebRequest ` https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/windows_386/AmazonSSMAgentSetup.exe ` -OutFile $env:USERPROFILE\Desktop\SSMAgent_latest.exe
    Start-Process ` -FilePath $env:USERPROFILE\Desktop\SSMAgent_latest.exe ` -ArgumentList "/S"
    rm -Force $env:USERPROFILE\Desktop\SSMAgent_latest.exe
    直接下载

    https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/windows_amd64/AmazonSSM AgentSetup .exe

    运行下载的 AmazonSSMAgentSetup.exe 文件以安装 SSM Agent。

  3. SSM Agent通过在中发送以下命令来启动或重新启动 PowerShell:

    Restart-Service AmazonSSMAgent

SSM Agent从 EC2 实例中卸载 Windows Server

要SSM Agent从Windows Server实例中卸载,请打开 “控制面板”、“程序”。选择 Uninstall a program(卸载程序)选项。打开 Amazon SSM Agent 的上下文(右键单击)菜单,选择 Uninstall(卸载)。