将 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
适用于 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 开发人员指南和代码示例的完整列表,请参阅 将 Systems Manager 与 AWS SDK 配合使用。本主题还包括有关入门的信息以及有关先前的 SDK 版本的详细信息。