将 DescribeInstanceAssociationsStatus
与 Amazon SDK 或 CLI 配合使用
以下代码示例演示如何使用 DescribeInstanceAssociationsStatus
。
- CLI
-
- Amazon CLI
-
描述实例关联的状态
此示例显示实例关联的详细信息。
命令:
aws ssm describe-instance-associations-status --instance-id "i-1234567890abcdef0"
输出:
{ "InstanceAssociationStatusInfos": [ { "AssociationId": "8dfe3659-4309-493a-8755-0123456789ab", "Name": "AWS-GatherSoftwareInventory", "DocumentVersion": "1", "AssociationVersion": "1", "InstanceId": "i-1234567890abcdef0", "ExecutionDate": 1550501886.0, "Status": "Success", "ExecutionSummary": "1 out of 1 plugin processed, 1 success, 0 failed, 0 timedout, 0 skipped. ", "AssociationName": "Inventory-Association" }, { "AssociationId": "5c5a31f6-6dae-46f9-944c-0123456789ab", "Name": "AWS-UpdateSSMAgent", "DocumentVersion": "1", "AssociationVersion": "1", "InstanceId": "i-1234567890abcdef0", "ExecutionDate": 1550505828.548, "Status": "Success", "DetailedStatus": "Success", "AssociationName": "UpdateSSMAgent" } ] }
-
有关 API 详细信息,请参阅《Amazon CLI Command Reference》中的 DescribeInstanceAssociationsStatus
。
-
- PowerShell
-
- 适用于 PowerShell 的工具
-
示例 1:此示例显示实例关联的详细信息。
Get-SSMInstanceAssociationsStatus -InstanceId "i-0000293ffd8c57862"
输出:
AssociationId : d8617c07-2079-4c18-9847-1655fc2698b0 DetailedStatus : Pending DocumentVersion : 1 ErrorCode : ExecutionDate : 2/20/2015 8:31:11 AM ExecutionSummary : temp_status_change InstanceId : i-0000293ffd8c57862 Name : AWS-UpdateSSMAgent OutputUrl : Status : Pending
示例 2:此示例检查给定实例 ID 的实例关联状态,并进一步显示这些关联的执行状态
Get-SSMInstanceAssociationsStatus -InstanceId i-012e3cb4df567e8aa | ForEach-Object {Get-SSMAssociationExecution -AssociationId .AssociationId}
输出:
AssociationId : 512a34a5-c678-1234-1234-12345678db9e AssociationVersion : 2 CreatedTime : 3/2/2019 8:53:29 AM DetailedStatus : ExecutionId : 512a34a5-c678-1234-1234-12345678db9e LastExecutionDate : 1/1/0001 12:00:00 AM ResourceCountByStatus : {Success=9} Status : Success
-
有关 API 详细信息,请参阅《Amazon Tools for PowerShell Cmdlet Reference》中的 DescribeInstanceAssociationsStatus。
-
有关 Amazon SDK 开发人员指南和代码示例的完整列表,请参阅 将 Systems Manager 与 Amazon SDK 配合使用。本主题还包括有关入门的信息以及有关先前的 SDK 版本的详细信息。
DescribeEffectivePatchesForPatchBaseline
DescribeInstanceInformation