SSM Agent在 EC2 執行個體上手動安裝和解除安裝 Windows Server - AWS Systems Manager

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

SSM Agent在 EC2 執行個體上手動安裝和解除安裝 Windows Server

AWS Systems Manager 根據預設,會在 Amazon Windows Server 提供的下列 Amazon Machine Images (AMIs) 上預先安裝代理程式 ():SSM Agent

  • Windows Server 2008-2012 R2 AMIs 發佈於 2016 月 11 月或之後

  • Windows Server 2016、2019 和 2022

SSM Agent在 EC2 執行個體上安裝 Windows Server

如有需要,您可以使用以下程序,在 Windows Server 的 Amazon Elastic Compute Cloud (Amazon EC2) 執行個體上手動下載並安裝最新版本的 SSM Agent。此程序中所提供的命令也可以透過使用者資料,以指令碼的形式傳遞至 Amazon EC2 執行個體。

SSM Agent需要 Windows PowerShell 3.0 或更新版本,才能在執行個體 (例如,舊版文件) 上Windows Server執行某些 AWS Systems Manager 文件 (SSM AWS-ApplyPatchBaseline 文件)。確認您的 Windows Server 執行個體執行 Windows Management Framework 3.0 或更新版本。這個框架包括視窗 PowerShell。如需詳細資訊,請參閱 Windows Management Framework 3.0

注意

此程序適用於在 Windows Server 的 EC2 執行個體上安裝或重新安裝 SSM Agent。如果您需要在內部部署伺服器或虛擬機器 (VM) 上安裝代理程式,以便與 Systems Manager 搭配使用,請參閱為混合環境 (Windows) 安裝 SSM Agent

在 Windows Server 的 EC2 執行個體上手動安裝 SSM Agent 的最新版本
  1. 使用遠端桌面或 Windows Connect 至您的執行個體 PowerShell。如需詳細資訊,請參閱《Amazon EC2 Windows 執行個體使用者指南》中的連線到您的執行個體

  2. 下載最新版本的 SSM Agent 到您的執行個體。您可以使用 PowerShell 命令或直接下載鏈接進行下載。

    注意

    此步驟中的 URL 可讓您SSM Agent從任何網址下載 AWS 區域。如果您想要從特定區域下載代理程式,請改為使用區域特定的 URL:

    https://amazon-ssm-region.s3.region.amazonaws.com/latest/windows_amd64/AmazonSSMAgentSetup.exe

    地區代表 AWS 區域 支援的識別碼 AWS Systems Manager,us-east-2例如美國東部 (俄亥俄) 區域。如需支援的 region 值的清單,請參閱《Amazon Web Services 一般參考》Systems Manager 服務端點一節的區域資料欄。

    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
    直接下載

    使用下列連結,下載 SSM Agent 的最新版本至執行個體。如果需要,請使用 AWS 區域特定 URL 更新此 URL。

    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 (解除安裝)。