本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
命令文件外掛程式參考
此參考說明您可以在 AWS Systems Manager (SSM) Command 類型文件中指定的外掛程式。這些外掛程式無法在使用自動SSM化動作的自動化工作手冊中使用。如需「 AWS Systems Manager 自動化」動作的資訊,請參閱Systems Manager Automation 動作參考。
Systems Manager 會藉由讀取SSM文件的內容,決定要在代管執行個體上執行的動作。每個文件包含程式碼執行部分。根據您文件的結構描述版本,這個程式碼執行部分可以包含一或多個外掛程式或步驟。有關於此的說明主題,外掛程式和步驟稱為 外掛程式。本節包含關於每個 Systems Manager 外掛程式的資訊。如需有關文件,包含建立文件和結構描述版本之間差異的更多資訊,請參閱 AWS Systems Manager Documents。
注意
此處說明的一些外掛程式僅能夠在 Windows Server 執行個體或 Linux 執行個體上執行。每個外掛程式須注意平台相容性。
Amazon 彈性運算雲端 (AmazonEC2) 執行個體支援下列文件外掛程式macOS:
-
aws:refreshAssociation
-
aws:runShellScript
-
aws:runPowerShellScript
-
aws:softwareInventory
-
aws:updateSsmAgent
目錄
共用的輸入
透過 SSM Agent 3.0.502 版及更新版本,所有外掛程式都可使用以下輸入:
- finallyStep
-
您想要文件執行的最後一個步驟。如果對步驟定義了此輸入,則它的優先順序高於在
onFailure
或onSuccess
輸入中指定的exit
值。若要讓具有此輸入的步驟預期執行,該步驟必須是在文件的mainSteps
中定義的最後一步。類型:布林值
有效值:
true
|false
必要:否
- onFailure
-
如果您為具有
exit
值的外掛程式指定此輸入,且該步驟失敗,則步驟狀態會反映失敗,而且文件不會執行任何剩餘的步驟,除非已定義finallyStep
。如果您為具有successAndExit
值的外掛程式指定此輸入,且該步驟失敗,則步驟狀態會顯示成功,而且文件不會執行任何剩餘的步驟,除非已定義finallyStep
。類型:字串
有效值:
exit
|successAndExit
必要:否
- onSuccess
-
如果您為外掛程式指定此輸入,且該步驟成功執行,則文件不會執行任何剩餘的步驟,除非已定義
finallyStep
。類型:字串
有效值:
exit
必要:否
aws:applications
在EC2執行個體上安裝、修復或解除安裝應用程式。這個外掛程式只能在 Windows Server 作業系統上執行。
語法
結構描述 2.2
結構描述 1.2
屬性
- 動作
-
採取動作
類型:列舉
有效值:
Install
|Repair
|Uninstall
必要:是
- parameters
-
安裝的參數。
類型:字串
必要:否
- source
-
應用程式的
.msi
檔案。URL類型:字串
必要:是
- sourceHash
-
.msi
檔案的SHA256雜湊值。類型:字串
必要:否
aws:cloudWatch
Windows Server將資料從 Amazon CloudWatch 或 Amazon CloudWatch 日誌匯出,並使用 CloudWatch 指標監控資料。這個外掛程式只能在 Windows Server 作業系統上執行。如需設定與 Amazon 彈性運算雲端 (AmazonEC2) CloudWatch 整合的詳細資訊,請參閱 Amazon CloudWatch 使用者指南中的使用 CloudWatch 代理程式收集指標、日誌和追蹤。
重要
整合的 CloudWatch 代理程式已取代SSM Agent為將日誌資料傳送至 Amazon CloudWatch 日誌的工具。不支援 SSM Agent aws: cloudWatch 外掛程式。我們建議您只使用統一的 CloudWatch 代理程式來進行記錄收集程序。如需詳細資訊,請參閱下列主題:
您可以匯出和監控以下資料類型:
- ApplicationEventLog
-
將應用程式事件記錄資料傳送至 CloudWatch 記錄檔
- CustomLogs
-
將任何以文字為基礎的日誌檔傳送到 Amazon CloudWatch 日誌。 CloudWatch 外掛程式會為記錄檔建立指紋。系統會將資料位移與每個指紋建立關聯。當檔案改變時,外掛程式上傳檔案並記錄位移然後建立與指紋的關聯。此方法用於避免使用者開啟外掛程式,將服務與包含大量檔案的目錄關聯,並且系統會上傳所有檔案。
警告
請注意,如果您的應用程式在輪詢時嘗試截斷或清理日誌的任何日誌,任何
LogDirectoryPath
指定的日誌將可能遺失項目。例如,如果您想要限制的日誌檔案大小,達到該限制時建立新的日誌檔,然後持續將資料寫入新的檔案。 - ETW
-
將 Windows (ETW) 資料的事件追蹤傳送至 CloudWatch 記錄檔。
- IIS
-
將記IIS錄檔資料傳送至 CloudWatch 記錄檔。
- PerformanceCounter
-
將視窗效能計數器傳送至 CloudWatch。您可以選取要 CloudWatch 作為量度上傳的不同類別。針對您要上傳的每個效能計數器,建立具有唯一 ID 的PerformanceCounter區段 (例如,"PerformanceCounter2"、" PerformanceCounter 3" 等),並設定其內容。
注意
如果 AWS Systems Manager SSM Agent或 CloudWatch 外掛程式停止,效能計數器資料就不會登入 CloudWatch。此行為不同於自訂日誌或 Windows 事件日誌。自訂記錄檔和 Windows 事件記錄會保留效能計數器資料,並將其上傳至 CloudWatch 之後SSM Agent或 CloudWatch 外掛程式可用。
- SecurityEventLog
-
將安全事件記錄檔資料傳送至 CloudWatch 記錄檔。
- SystemEventLog
-
將系統事件記錄檔資料傳送至 CloudWatch 記錄檔。
您可以定義以下資料的目的地:
- CloudWatch
-
傳送您的效能計數器指標資料的目的地。您可以新增更多具有唯一性的區段 IDs (例如,"CloudWatch2"、 CloudWatch 3" 等),並為每個新 ID 指定不同的區域,以便將相同的資料傳送至不同的位置。
- CloudWatchLogs
-
傳送您的效能計數器日誌資料的目的地。您可以新增更多具有唯一性的區段 IDs (例如,"CloudWatchLogs2"、 CloudWatchLogs 3" 等),並為每個新 ID 指定不同的區域,以便將相同的資料傳送至不同的位置。
語法
"runtimeConfig":{ "aws:cloudWatch":{ "settings":{ "startType":"{{ status }}" }, "properties":"{{ properties }}" } }
設定和屬性
- AccessKey
-
您的 存取金鑰 ID。除非您使用角色啟動執行個體,否則必須使IAM用此屬性。此屬性不能與SSM.
類型:字串
必要:否
- CategoryName
-
效能監控從效能計數器類別而來。
類型:字串
必要:是
- CounterName
-
效能監控的名稱從效能計數器類別而來。
類型:字串
必要:是
- CultureName
-
要記錄時間戳記的所在地區。如果CultureName為空白,則預設為Windows Server執行個體所使用的相同語言環境。
類型:字串
有效值:如需支援的值清單,請參閱 Microsoft 網站上的國家語言 Support 援 (NLS)
。不支援 div、div-MV、hu 和 hu-HU 值。 必要:否
- DimensionName
-
Amazon CloudWatch 指標的維度。若您指定
DimensionName
,您必須指定DimensionValue
。在列出指標時,這些參數會提供另一種視圖。您也可以針對多個指標使用同一種維度,如此就能檢視屬於特定維度的所有指標。類型:字串
必要:否
- DimensionValue
-
Amazon CloudWatch 指標的維度值。
類型:字串
必要:否
- 編碼
-
要使用的檔案編碼 (例如 UTF -8)。使用編碼名稱,而非顯示名稱。
類型:字串
有效數值: 如需支援值的清單,請參閱 Microsoft Learn Library 中的編碼類別
。 必要:是
- 篩選條件
-
日誌名稱的字首。將此參數留白,以監控所有檔案。
類型:字串
有效值:如需支援值的清單,請參閱資MSDN源庫中的FileSystemWatcherFilter 性質
。 必要:否
- 流程
-
要上傳的每種資料類型,以及資料的目的地 (CloudWatch 或 CloudWatch 記錄檔)。例如,若要將下定義的效能計數器傳送
"Id": "PerformanceCounter"
至下定義的 CloudWatch 目的地"Id": "CloudWatch"
,請輸入 "PerformanceCounter,CloudWatch"。同樣地,若要將自訂記錄、記ETW錄和系統記錄檔傳送至下方定義的 CloudWatch 記錄目的地"Id": "ETW"
,請輸入 「(ETW)CloudWatchLogs」。除此之外,您可以將相同的效能計數器或日誌檔案傳送到一個以上的目的地。例如,若要將應用程式記錄檔傳送至您在下"Id": "CloudWatchLogs"
方定義的兩個不同目的地 ApplicationEventLog,請輸入 "CloudWatchLogs, (, CloudWatchLogs 2)」。"Id": "CloudWatchLogs2"
類型:字串
有效數值 (來源):
ApplicationEventLog
|CustomLogs
|ETW
|PerformanceCounter
|SystemEventLog
|SecurityEventLog
有效值(目的地):
CloudWatch
|CloudWatchLogs
|CloudWatch
n
|CloudWatchLogs
n
必要:是
- FullName
-
元件的完全名稱。
類型:字串
必要:是
- Id
-
識別資料來源或目的地。這識別符在組態檔案中必須是唯一的。
類型:字串
必要:是
- InstanceName
-
效能計數器執行個體的名稱。請勿使用星號 (*) 來表示所有的執行個體,因為每個效能計數器元件只支援一個指標。不過您可以使用 _Total。
類型:字串
必要:是
- 層級
-
該類型的消息發送到 Amazon CloudWatch。
類型:字串
有效值:
-
1 – 只上傳錯誤訊息。
-
2 – 只上傳警告訊息。
-
4 – 只上傳資訊訊息。
您可以一起新增值,以包含多個類型訊息。例如,3 表示錯誤訊息 (1) 和警告訊息 (2)都包含。數值 7 表示包含錯誤訊息 (1)、警告訊息 (2) 和資訊訊息 (4)。
必要:是
注意
Windows Security Logs 應該設定層級為 7。
-
- LineCount
-
標頭中的行數,以辨識日誌檔案。例如,IIS記錄檔具有幾乎相同的標頭。您可以輸入 3,這會讀取日誌檔標頭的前三行來進行辨識。在IIS記錄檔中,第三行是日期和時間戳記,這在記錄檔之間不同。
類型:整數
必要:否
- LogDirectoryPath
-
對於 CustomLogs,記錄檔儲存在EC2執行個體上的路徑。對於IIS記錄檔,個別網站儲存IIS記錄檔的資料夾 (例如,C:\\ inetpub\\ 記錄檔\LogFiles\ W3 SVC
n
). 對於IIS記錄檔,僅支援 W3C 記錄檔格式。IISNCSA、和「自訂」格式不受支援。類型:字串
必要:是
- LogGroup
-
您的日誌群組名稱。此名稱會顯示在 CloudWatch主控台的「記錄群組」畫面上。
類型:字串
必要:是
- LogName
-
日誌檔案的名稱。
-
若要在導覽窗格的事件檢視器中查找日誌名稱,請選取 Applications and Services Logs (應用程式和服務日誌)。
-
在日誌清單中,在您要上傳的日誌上按一下滑鼠右鍵 (例如,Microsoft > Windows > 備份 > 操作),然後選取 Create Custom View (建立自訂檢視)。
-
在「建立自訂視圖」對話方塊中,選取XML頁籤。位LogName於 < 選取路徑 => 標籤中 (例如,
Microsoft-Windows-Backup
)。將此文字複製到LogName參數中。
類型:字串
有效值:
Application
|Security
|System
|Microsoft-Windows-WinINet/Analytic
必要:是
-
- LogStream
-
日誌串流目的地的名稱 若您使用 {instance_id},日誌串流名稱是這個執行個體 ID 的預設值。
類型:字串
有效值:
{instance_id}
|{hostname}
|{ip_address}
<log_stream_name>
如果您輸入的記錄串流名稱尚未存在, CloudWatch Logs 會自動為您建立該名稱。您可以使用文字字串或預先定義的變數 ({instance_id}, {hostname}, {ip_address},或是組合全部三者來定義日誌串流名稱。
此參數中指定的記錄資料流名稱會顯示在「記錄群組 > 串流」上
<YourLogStream>
屏幕在 CloudWatch 控制台中。必要:是
- MetricName
-
您希望效能資料包含在其下的 CloudWatch 量度。
注意
請不要在名稱中使用特殊字元。如果您這麼做了、指標和相關警示可能不會運作。
類型:字串
必要:是
- NameSpace
-
將會在指標命名空間寫入效能計數器資料。
類型:字串
必要:是
- PollInterval
-
上傳新的效能計數器和日誌資料時需要延遲多少秒。
類型:整數
有效值:將此屬性設為 5 個或多個秒。十五秒 (00:00:15) 是建議。
必要:是
- 區域
-
您 AWS 區域 要傳送記錄資料的位置。雖然您可以將效能計數器,傳送到與您傳送日誌資料所在位置不同的區域,還是建議您將此參數,設定為與執行個體執行位置相同的區域。
類型:字串
有效值:Systems Manager 和 CloudWatch 記錄檔 AWS 區域 支援IDs的區域,例如
us-east-2
eu-west-1
、和ap-southeast-1
。如需每個服務 AWS 區域 支援的清單,請參閱中的 Amazon CloudWatch 日誌服務端點和 Systems Manager 服務端點Amazon Web Services 一般參考。必要:是
- SecretKey
-
您的 私密存取金鑰。除非您使用角色啟動執行個體,否則必須使IAM用此屬性。
類型:字串
必要:否
- startType
-
開啟或關閉執 CloudWatch 行個體。
類型:字串
有效值:
Enabled
|Disabled
必要:是
- TimestampFormat
-
要使用的時間戳記格式。如需支援值的清單,請參閱元件MSDN庫中的自訂日期和時間格式字串
。 類型:字串
必要:是
- TimeZoneKind
-
當您的日誌時間戳記中沒有時區資訊時,您需要提供時區資訊。如果此參數保留空白,而且您的時間戳記不包含時區資訊,則 CloudWatch Logs 會預設為本地時區。如果時間戳記已包含時區資訊,則會忽略此參數。
類型:字串
有效值:
Local
|UTC
必要:否
- 單位
-
適合指標的測量單位。
類型:字串
有效數值: 秒 | 微秒 | 毫秒 | 位元組 | 千位元組 (KB) | 百萬位元組 (MB) | 十億位元組 (GB) | 兆位元組 (TB) | 位元 | 千位元 (kb) | 百萬位元 (Mb) | 十億位元 (Gb) | 兆位元 (Tb) | 百分比 | 計數 | 位元組/秒 | 千位元組 (KB)/秒 | 百萬位元組 (MB)/秒 | 十億位元組 (GB)/秒 | 兆位元組 (TB)/秒 | 位元/秒 | 千位元 (kb)/ 秒 | 百萬位元 (Mb)/秒 | 十億位元 (Gb)/秒 | 兆位元 (Tb)/秒 | 計數/秒 | 無。
必要:是
aws:configureDocker
(結構描述 2.0 版本或更新版本) 設定執行個體來處理 Docker 和容器。Linux 和 Windows Server 作業系統上支援此外掛程式。
語法
結構描述 2.2
輸入
- 動作
-
執行動作的類型。
類型:列舉
有效值:
Install
|Uninstall
必要:是
aws:configurePackage
(架構 2.0 版或更新版本)安裝或解除安裝 AWS Systems Manager Distributor套件。您可以安裝最新版本、預設版本或您指定的套件版本。也支援由提供 AWS 的套件。這個外掛程式可在 Windows Server 和 Linux 作業系統上執行,但 Linux 作業系統不支援所有的可用套件。
可用的 AWS 套件Windows Server包括下列項目:AWSPVDriver
AWSNVMe
AwsEnaNetworkDriver
、AwsVssComponents
、AmazonCloudWatchAgent
、、CodeDeployAgent
、和 AWSSupport-EC2Rescue.
Linux 作業系統可用的 AWS 套件包括下列項目:AmazonCloudWatchAgent
CodeDeployAgent
、和AWSSupport-EC2Rescue
。
語法
結構描述 2.2
輸入
- name
-
要安裝或解除安 AWS 裝的套件名稱。可用套件包括:
AWSPVDriver
、AwsEnaNetworkDriver
、AwsVssComponents
和AmazonCloudWatchAgent
。類型:字串
必要:是
- 動作
-
安裝或解除安裝套件
類型:列舉
有效值:
Install
|Uninstall
必要:是
- installationType
-
要執行的安裝類型。如果您指定
Uninstall and reinstall
,套件會完全解除安裝,然後重新安裝。在重新安裝完成之前,應用程式無法使用。如果您指定In-place update
,根據您在更新指令碼中提供的指示,只會將新的或變更的檔案新增至現有的安裝。應用程式在整個更新程序中仍然可用。 AWS已發佈的套件不支援In-place update
此選項。Uninstall and reinstall
為預設值。類型:列舉
有效值:
Uninstall and reinstall
|In-place update
必要:否
- additionalArguments
-
提供給安裝、解除安裝或更新指令碼的其他參數JSON字串。每個參數必須加上字首
SSM_
。通過使用慣例{{ssm:
,您可以參考其他引數中的 Parameter Store 參數。若要在安裝、解除安裝或更新指令碼中使用其他參數,您必須使用適用於作業系統的語法,將參數作為環境變數參考。例如,在中 PowerShell,您將parameter-name
}}SSM_arg
引數引用為$Env:SSM_arg
。您定義的引數數目沒有限制,但額外的引數輸入有 4096 個字元限制。此限制包括您定義的所有金鑰和值。類型: StringMap
必要:否
- version
-
特定版本的套件安裝或解除安裝。如果安裝,系統預設會安裝最新發佈的版本。如果移除,系統預設移除目前已安裝的版本。如果沒有找到任何安裝的版本,執行下載和解除安裝最新版本的動作。
類型:字串
必要:否
aws:domainJoin
將EC2執行個體加入網域。這個外掛程式可在 Linux 和 Windows Server 作業系統上執行。該插件將 Linux 實例的主機名更改為格式 EC2AMAZ-XXXXXXX
。 EC2如需有關加入EC2執行個體的詳細資訊,請參閱《 AWS 管理指南》中的將執行個體加入受AWS Directory Service 管理的 Microsoft AD 目錄。
語法
結構描述 2.2
結構描述 1.2
屬性
- directoryId
-
目錄的 ID。
類型:字串
必要:是
範例:directoryId"":"
- directoryName
-
網域的名稱。
類型:字串
必要:是
範例:"directoryName": "例如.
- directoryOU
-
組織單位 (OU)。
類型:字串
必要:否
範例:"directoryOU": "OU=test,DC=example,DC=com"
- dnsIpAddresses
-
DNS伺服器的 IP 位址。
類型: StringList
必要:是
範例:"dnsIpAddresses": ["198.51.100.1",
- keepHostName
-
決定是否在加入網域時變更 Linux 執行個體的主機名稱。
類型:布林值
必要:否
範例
如需範例,請參閱AWS Directory Service 管理指南中的將 Amazon EC2 執行個體加 AWS Managed Microsoft AD入您的執行個體。
aws:downloadContent
(結構描述版本 2.0 或更新版本) 從遠端位置下載SSM文件和指令碼。 GitHub Enterprise不支援儲存庫。Linux 和 Windows Server 作業系統上支援此外掛程式。
語法
結構描述 2.2
輸入
- sourceType
-
下載來源。Systems Manager 支援下列來源類型來下載指令碼和SSM文件:
GitHub
Git
HTTP
、S3
、、和SSMDocument
。類型:字串
必要:是
- sourceInfo
-
從所需的來源中擷取所需的資訊內容。
類型: StringMap
必要:是
對於 sourceType
GitHub,
指定以下內容:-
擁有者:儲存庫擁有者。
-
儲存庫: 儲存庫的名稱。
-
路徑:您想要下載的檔案或目錄路徑。
-
getOptions:用於從 master 以外的分支或存儲庫中的特定提交中檢索內容的額外選項。 getOptions 如果您在 master 分支中使用最新的提交,則可以省略。如果您的儲存庫是在 2020 年 10 月 1 日之後建立的,則預設分支可能被命名為 main 而不是 master。在這種情況下,您將需要指定getOptions參數的值。
此參數使用以下的格式:
-
分支:參考/頭/
branch_name
預設值為
master
。若要指定非預設分支,請使用以下格式:
分支:參考/頭/
branch_name
-
commitID:
commitID
預設值為
head
。若要在最新提交以外的提交中使用SSM文件的版本,請指定完整的提交 ID。例如:
"getOptions": "commitID:bbc1ddb94...b76d3bEXAMPLE",
-
-
tokenInfo:Systems Manager 參數(參 SecureString數),您可以在其中以格式存儲GitHub訪問令牌信息
{{ssm-secure:
。secure-string-token-name
}}注意
此
tokenInfo
欄位是唯一支援 SecureString 參數的SSM文件外掛程式欄位。 SecureString 參數不支援任何其他欄位,也不支援任何其他SSM文件外掛程式。
{ "owner":"TestUser", "repository":"
GitHubTest
", "path":"scripts/python/test-script
", "getOptions":"branch:master", "tokenInfo":"{{ssm-secure:secure-string-token
}}" }對於 sourceType
Git
,您必須指定下列項目:-
repository
Git 存儲庫URL到您要下載的文件或目錄。
類型:字串
此外,您還可以指定下列選用參數:
-
getOptions
用於從 master 以外的分支或存儲庫中的特定提交中檢索內容的額外選項。 getOptions 如果您在 master 分支中使用最新的提交,則可以省略。
類型:字串
此參數使用以下的格式:
-
分支:參考/頭/
branch_name
預設值為
master
。"branch"
只有當您的SSM文件儲存在以外的分支中時才需要master
。例如:"getOptions": "branch:refs/head/main"
-
commitID:
commitID
預設值為
head
。若要在最新提交以外的提交中使用SSM文件的版本,請指定完整的提交 ID。例如:
"getOptions": "commitID:bbc1ddb94...b76d3bEXAMPLE",
-
-
privateSSHKey
連接到
repository
您指定的時候要使用的SSH金鑰。您可以使用下列格式來SecureString
參照索引SSH鍵值的參數:{{ssm-secure:
。your-secure-string-parameter
}}類型:字串
-
skipHostKey檢查中
連接至
repository
您指定的時,決定 StrictHostKeyChecking選項的值。預設值為false
。類型:布林值
-
使用者名稱
連線至您使用指定的時所使用的
repository
使用者名稱HTTP。您可以使用下列格式來參考使用者名稱值的SecureString
參數:{{ssm-secure:
。your-secure-string-parameter
}}類型:字串
-
密碼
連線至您使用指定的時所
repository
使用的密碼HTTP。您可以使用下列格式來參考密碼值的SecureString
參數:{{ssm-secure:
。your-secure-string-parameter
}}類型:字串
對於 sourceType
HTTP
,您必須指定下列項目:-
url
URL到您要下載的檔案或目錄。
類型:字串
此外,您還可以指定下列選用參數:
-
allowInsecureDownload
決定是否可透過未使用安全通訊端層 (SSL) 或傳輸層安全性 () 加密的連線執行下載。TLS預設值為
false
。不建議在未加密的情況下執行下載。如果您選擇這樣做,您應承擔所有相關風險。安全是 AWS 與您之間共同的責任。這被描述為共同的責任模式。如需進一步了解,請參閱共同的責任模型。 類型:布林值
-
authMethod
當連線至您指定的
url
時,判斷是否要使用使用者名稱和密碼進行身分驗證。如果您指定Basic
或Digest
,則必須提供username
和password
參數的值。若要使用Digest
方法,必須在您的執行個體上安裝 SSM Agent 3.0.1181.0 版或更新版本。該Digest
方法支持MD5和SHA256加密。類型:字串
有效值:
None
|Basic
|Digest
-
使用者名稱
使用
Basic
身分驗證連線至您指定的url
時,要使用的使用者名稱。您可以使用下列格式來參考使用者名稱值的SecureString
參數:{{ssm-secure:
。your-secure-string-parameter
}}類型:字串
-
密碼
使用
Basic
身分驗證連線至您指定的url
時,要使用的密碼。您可以使用下列格式來參考密碼值的SecureString
參數:{{ssm-secure:
。your-secure-string-parameter
}}類型:字串
對於 sourceType
S3
,指定下列項目:-
路徑:URL要從 Amazon S3 下載的文件或目錄。
{ "path": "https://s3.amazonaws.com/
amzn-s3-demo-bucket
/powershell/helloPowershell.ps1" }對於 sourceType
SSMDocument
,指定下列其中一項:-
名稱:名稱和文件的版本,格式如下:
name:version
。版本是非必須的。{ "name": "Example-RunPowerShellScript:3" }
-
name:以下列格式的文件:ARN
arn:aws:ssm:
region
:account_id
:document/document_name
{ "name":"arn:aws:ssm:us-east-2:3344556677:document/MySharedDoc" }
-
- destinationPath
-
將您想要下載的檔案選用在的執行個體上的本機路徑。如果您不指定路徑的相對路徑,內容會下載到您的命令 ID 相對應的路徑。
類型:字串
必要:否
aws:psModule
在 Amazon EC2 執行個體上安裝 PowerShell 模組。這個外掛程式只能在 Windows Server 作業系統上執行。
語法
結構描述 2.2
結構描述 1.2
屬性
- runCommand
-
安裝模組後要執行的 PowerShell 命令。
類型: StringList
必要:否
- source
-
執行個體上應用程式
.zip
檔案的URL或本機路徑。類型:字串
必要:是
- sourceHash
-
.zip
檔案的SHA256雜湊值。類型:字串
必要:否
- timeoutSeconds
-
在命令完成到被認定為失敗之間的秒數。
類型:字串
必要:否
- workingDirectory
-
在您的執行個體上的工作目錄路徑。
類型:字串
必要:否
aws:refreshAssociation
(結構描述 2.0 版本或更新版本) 更新 (強制套用) 有需要的關聯。這個動作會根據選中的關聯或者全部與目標有聯結的關聯裡的定義來改變系統的狀態。這個外掛程式可在 Linux 和 Microsoft Windows Server 作業系統上執行。
語法
結構描述 2.2
輸入
- associationIds
-
關聯清單IDs。如果空,所有綁定到指定的目標的關聯都會被套用。
類型: StringList
必要:否
aws:runDockerAction
(結構描述 2.0 版本或更新版本) 在容器上執行 Docker 動作。這個外掛程式可在 Linux 和 Microsoft Windows Server 作業系統上執行。
語法
結構描述 2.2
輸入
- 動作
-
執行動作的類型。
類型:字串
必要:是
- 容器
-
Docker 容器的 ID。
類型:字串
必要:否
- image
-
Docker 影像名稱
類型:字串
必要:否
- 命令提示字元
-
容器指令
類型:字串
必要:否
- memory
-
容器記憶體限制。
類型:字串
必要:否
- cpuShares
-
容器CPU共享(相對重量)。
類型:字串
必要:否
- 磁碟區
-
容器磁碟容量。
類型: StringList
必要:否
- env
-
容器的環境變數。
類型:字串
必要:否
- 使用者
-
容器的使用者名稱。
類型:字串
必要:否
- 發布
-
容器發佈的連接埠。
類型:字串
必要:否
aws:runDocument
(架構 2.0 版或更新版本) 執行SSM儲存在 Systems Manager 或本機共用上的文件。您可以將此外掛程式與aws:downloadContent外掛程式搭配使用,將SSM文件從遠端位置下載到本機共用,然後執行它。Linux 和 Windows Server 作業系統上支援此外掛程式。此外掛程式不支援執行 AWS-UpdateSSMAgent
文件或任何使用 aws:updateSsmAgent
外掛程式的文件。
語法
結構描述 2.2
輸入
- documentType
-
執行的文件類型。您可以執行本機文件 (
LocalPath
) 或存放在 Systems Manager (SSMDocument
) 的文件。類型:字串
必要:是
- documentPath
-
文件的路徑。如果
documentType
是LocalPath
,請指定在本機共享的文件路徑。如果documentType
是SSMDocument
,請指定文件的名稱。類型:字串
必要:否
- documentParameters
-
文件的參數。
類型: StringMap
必要:否
aws:runPowerShellScript
執行指 PowerShell 令碼或指定要執行之指令碼的路徑。這個外掛程式可在 Microsoft Windows Server 和 Linux 作業系統上執行。
語法
結構描述 2.2
結構描述 1.2
屬性
- runCommand
-
指定命令或指定在執行個體上現有的指令碼的路徑來執行。
類型: StringList
必要:是
- timeoutSeconds
-
在命令完成到被認定為失敗之間的秒數。如果達到逾時,Systems Manager 停止命令執行。
類型:字串
必要:否
- workingDirectory
-
在您的執行個體上的工作目錄路徑。
類型:字串
必要:否
aws:runShellScript
執行 Linux shell 指令碼或指定路徑來執行指令碼。這個外掛程式只可在 Linux 作業系統上執行。
語法
結構描述 2.2
結構描述 1.2
屬性
- runCommand
-
指定命令或指定在執行個體上現有的指令碼的路徑來執行。
類型: StringList
必要:是
- timeoutSeconds
-
在命令完成到被認定為失敗之間的秒數。如果達到逾時,Systems Manager 停止命令執行。
類型:字串
必要:否
- workingDirectory
-
在您的執行個體上的工作目錄路徑。
類型:字串
必要:否
aws:softwareInventory
(結構描述 2.0 版本或更新版本) 在受管執行個體上收集與應用程式、檔案和組態相關的中繼資料。這個外掛程式可在 Linux 和 Microsoft Windows Server 作業系統上執行。當您設定詳細目錄收集時,請先建立 AWS Systems Manager State Manager關聯。Systems Manager 會在執行關聯時收集庫存資料。如果沒有先建立關聯,則當您試圖叫用 aws:softwareInventory
外掛程式時,系統會傳回以下錯誤:
The aws:softwareInventory
plugin can only be invoked via ssm-associate.
執行個體一次只能設定一個庫存關聯。若您為執行個體設定兩個以上的關聯,庫存關聯便不會執行,並且也不會收集任何庫存資料。如需收集庫存的相關資訊,請參閱 AWS Systems Manager庫存。
語法
結構描述 2.2
輸入
- 應用程式
-
(選用) 收集已安裝應用程式的中繼資料。
類型:字串
必要:否
- awsComponents
-
(選擇性) 收集 AWS 元件的中繼資料,例如 amazon-ssm-agent。
類型:字串
必要:否
- files
-
(選用,需要 SSM Agent 2.2.64.0 版或更新版本) 收集檔案的中繼資料,包括檔案名稱、檔案的建立時間、上次修改和存取檔案的時間以及檔案大小等。如需收集檔案庫存的相關資訊,請參閱 使用檔案與 Windows 登錄檔清查。
類型:字串
必要:否
- networkConfig
-
(選用) 收集網路組態的中繼資料。
類型:字串
必要:否
- windowsUpdates
-
(選用) 收集所有 Windows 更新的中繼資料。
類型:字串
必要:否
- instanceDetailedInformation
-
(選擇性) 收集的執行個體資訊多於預設清查外掛程式 (
aws:instanceInformation
) 所提供的執行個體資訊,包括CPU型號、速度和核心數量,僅舉幾例。類型:字串
必要:否
- services
-
(選用,僅 Windows 作業系統需要 SSM Agent 2.2.64.0 版或更新版本) 收集服務組態的中繼資料。
類型:字串
必要:否
- windowsRegistry
-
(選用,僅 Windows 作業系統需要 SSM Agent 2.2.64.0 版或更新版本) 收集 Windows 登錄機碼和值。而且,您還能選擇機碼路徑,並以遞迴方式收集所有機碼和值。此外,您也可以收集指定路徑的特定登錄機碼及其值。庫存將收集機碼路徑、名稱、類型與值。如需收集 Windows 登錄檔庫存的詳細資訊,請參閱 使用檔案與 Windows 登錄檔清查。
類型:字串
必要:否
- windowsRoles
-
(選用,僅 Windows 作業系統需要 SSM Agent 2.2.64.0 版或更新版本) 收集適用於 Microsoft Windows 角色組態的中繼資料。
類型:字串
必要:否
- customInventory
-
(選用) 收集自訂庫存資料。如需自訂庫存的詳細資訊,請參閱使用自訂庫存。
類型:字串
必要:否
aws:updateAgent
將EC2Config服務更新為最新版本或指定較舊的版本。這個外掛程式只能在 Microsoft Windows Server 作業系統上執行。如需有關EC2Config服務的詳細資訊,請參閱 Amazon 使用EC2者指南中的使用EC2Config服務 (舊版) 設定 Windows 執行個體。
語法
結構描述 2.2
結構描述 1.2
屬性
- agentName
-
EC2Config。這是執行EC2Config服務的代理程式名稱。
類型:字串
必要:是
- allowDowngrade
-
允許將EC2Config服務降級為較早的版本。如果設定為非,該服務只可以升級到較新版本 (預設)。如果設定為是,指定之前的舊版本。
類型:布林值
必要:否
- source
-
Systems Manager 複製EC2Config要安裝的版本的位置。您無法變更此位置。
類型:字串
必要:是
- targetVersion
-
要安裝的特定EC2Config服務版本。如果未指定,服務會更新到最新版本。
類型:字串
必要:否
aws:updateSsmAgent
將 SSM Agent 更新到最新版本或指定舊版本。這個外掛程式可在 Linux 和 Windows Server 作業系統上執行。如需詳細資訊,請參閱使用 SSM Agent。
語法
結構描述 2.2
結構描述 1.2
屬性
- agentName
-
amazon-ssm-agent。這是在執行個體上處理請求和執行命令的 Systems Manager 代理程式名稱。
類型:字串
必要:是
- allowDowngrade
-
允許 SSM Agent 降級到較早的版本。如果設定為非,代理程式只可以升級到較新版本 (預設)。如果設定為是,指定之前的舊版本。
類型:布林值
必要:是
- source
-
Systems Manager 複製 SSM Agent 版本進行安裝的位置。您無法變更此位置。
類型:字串
必要:是
- targetVersion
-
指定安裝 SSM Agent 的版本。如果未指定,代理程式會更新到最新版本。
類型:字串
必要:否