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

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

在适用于 Windows Server 的 EC2 实例上手动安装 SSM Agent

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

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

  • Windows Server 2016、2019 和 2022

如有必要,可以使用以下过程在 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/AmazonSSMAgentSetup.exe

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

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

    Restart-Service AmazonSSMAgent
卸载 SSM Agent

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