搭配使用 DescribeAssociationExecutions 與 CLI - AWS Systems Manager

搭配使用 DescribeAssociationExecutions 與 CLI

下列程式碼範例示範如何使用 DescribeAssociationExecutions

CLI
AWS CLI

範例 1:取得關聯之所有執行的詳細資訊

下列 describe-association-executions 範例說明指定關聯的所有執行。

aws ssm describe-association-executions \ --association-id "8dfe3659-4309-493a-8755-0123456789ab"

輸出:

{ "AssociationExecutions": [ { "AssociationId": "8dfe3659-4309-493a-8755-0123456789ab", "AssociationVersion": "1", "ExecutionId": "474925ef-1249-45a2-b93d-0123456789ab", "Status": "Success", "DetailedStatus": "Success", "CreatedTime": 1550505827.119, "ResourceCountByStatus": "{Success=1}" }, { "AssociationId": "8dfe3659-4309-493a-8755-0123456789ab", "AssociationVersion": "1", "ExecutionId": "7abb6378-a4a5-4f10-8312-0123456789ab", "Status": "Success", "DetailedStatus": "Success", "CreatedTime": 1550505536.843, "ResourceCountByStatus": "{Success=1}" }, ... ] }

如需詳細資訊,請參閱《AWS Systems Manager 使用者指南》中的檢視關聯歷史記錄

範例 2:取得關聯在特定日期和時間之後的所有執行的詳細資訊

下列 describe-association-executions 範例說明關聯在指定日期和時間之後的所有執行。

aws ssm describe-association-executions \ --association-id "8dfe3659-4309-493a-8755-0123456789ab" \ --filters "Key=CreatedTime,Value=2019-02-18T16:00:00Z,Type=GREATER_THAN"

輸出:

{ "AssociationExecutions": [ { "AssociationId": "8dfe3659-4309-493a-8755-0123456789ab", "AssociationVersion": "1", "ExecutionId": "474925ef-1249-45a2-b93d-0123456789ab", "Status": "Success", "DetailedStatus": "Success", "CreatedTime": 1550505827.119, "ResourceCountByStatus": "{Success=1}" }, { "AssociationId": "8dfe3659-4309-493a-8755-0123456789ab", "AssociationVersion": "1", "ExecutionId": "7abb6378-a4a5-4f10-8312-0123456789ab", "Status": "Success", "DetailedStatus": "Success", "CreatedTime": 1550505536.843, "ResourceCountByStatus": "{Success=1}" }, ... ] }

如需詳細資訊,請參閱《AWS Systems Manager 使用者指南》中的檢視關聯歷史記錄

PowerShell
Tools for PowerShell

範例 1:此範例傳回所提供關聯 ID 的執行

Get-SSMAssociationExecution -AssociationId 123a45a0-c678-9012-3456-78901234db5e

輸出:

AssociationId : 123a45a0-c678-9012-3456-78901234db5e AssociationVersion : 2 CreatedTime : 3/2/2019 8:53:29 AM DetailedStatus : ExecutionId : 123a45a0-c678-9012-3456-78901234db5e LastExecutionDate : 1/1/0001 12:00:00 AM ResourceCountByStatus : {Success=4} Status : Success

如需完整的 AWS SDK 開發人員指南和程式碼範例清單,請參閱透過 AWS SDK 使用此服務。此主題也包含有關入門的資訊和舊版 SDK 的詳細資訊。