如何在啟動時於 Amazon EC2 Windows 執行個體上安裝 AWS Systems Manager Agent (SSM Agent)?

2 分的閱讀內容
0

如何於啟動時在 Amazon Elastic Compute Cloud (Amazon EC2) Windows 執行個體上安裝 AWS Systems Manager Agent (SSM Agent)?

簡短描述

依預設,SSM Agent 安裝在 2016 年 11 月發佈的 Windows Server 2008-2012 R2 AMI 或更高版本上。SSM Agent 預設還會安裝在 Windows Server 2016 和 2019 AMI 上。

您必須在透過其他版本的 Windows AMI 建立的 Amazon EC2 執行個體上手動安裝 SSM Agent,包括匯入至 AWS 的映像。您可以在啟動之前,向 Amazon EC2 Windows 執行個體新增使用者資料來安裝 SSM Agent。

**重要提示:**截至 2020 年 1 月 14 日,Windows Server 2008 不再支援 Microsoft 的功能或安全更新。適用於 Windows Server 2008 和 2008 R2 的舊式 AMI 仍包括預先安裝的 SSM Agent 版本 2。AWS Systems Manager 不再正式支援 2008 年版本,而且也不再更新這些版本的 Windows Server 的代理程式。SSM Agent 版本 3.0 可能與 Windows Server 2008 和 2008 R2 上的所有作業均不相容。適用於 Windows Server 2008 版本的 SSM Agent 的最終官方支援版本為 2.3.1644.0。

在安裝 SSM Agent 之前,請檢閱以下資訊:

解決方案

1.    建立 AWS Identity and Access Management (IAM) 執行個體設定檔以使用 SSM Agent

2.    在使用啟動執行個體精靈來啟動執行個體時,請遵循步驟 1 至 5 操作。

3.    在 Configure Instance Details (設定執行個體詳細資訊) 頁面的 IAM role (IAM 角色) 下拉式清單中,選取您在步驟 1 中建立的執行個體設定檔。

4.    在 Configure Instance Details (設定執行個體詳細資訊) 頁面,展開 Advanced Details (進階詳細資訊)。

5.    對於 User data (使用者資料),請選擇 As text (作為文字)。在 User data (使用者資料) 方塊中,輸入以下資訊。

<powershell>
$dir = $env:TEMP + "\ssm"
New-Item -ItemType directory -Path $dir -Force
cd $dir
(New-Object System.Net.WebClient).DownloadFile("https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/windows_amd64/AmazonSSMAgentSetup.exe", $dir + "\AmazonSSMAgentSetup.exe")
Start-Process .\AmazonSSMAgentSetup.exe -ArgumentList @("/q", "/log", "install.log") -Wait
</powershell>

如需詳細資訊,請參閲 User data and the console (使用者資料和主控台)。

6.    完成新增其他參數,例如儲存、標籤和安全群組。

7.    啟動您的執行個體。

對於 Linux,請參閱如何在啟動時於 Amazon EC2 Linux 執行個體上安裝 AWS Systems Manager Agent (SSM Agent)?


相關資訊

自動更新 SSM Agent

在適用於 Windows Server 的 EC2 執行個體上手動安裝 SSM Agent

設定 SSM Agent 以使用適用於 Windows Server 執行個體的代理

設定 AWS Systems Manager

在適用於 Windows Server 的 EC2 執行個體上安裝和設定 SSM Agent

AWS 官方
AWS 官方已更新 2 年前