将 DescribeAssociation 与 CLI 配合使用 - AWS Systems Manager

DescribeAssociation 与 CLI 配合使用

以下代码示例演示如何使用 DescribeAssociation

CLI
AWS CLI

示例 1:获取关联的详细信息

以下 describe-association 示例描述指定关联 ID 的关联。

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

输出:

{ "AssociationDescription": { "Name": "AWS-GatherSoftwareInventory", "AssociationVersion": "1", "Date": 1534864780.995, "LastUpdateAssociationDate": 1543235759.81, "Overview": { "Status": "Success", "AssociationStatusAggregatedCount": { "Success": 2 } }, "DocumentVersion": "$DEFAULT", "Parameters": { "applications": [ "Enabled" ], "awsComponents": [ "Enabled" ], "customInventory": [ "Enabled" ], "files": [ "" ], "instanceDetailedInformation": [ "Enabled" ], "networkConfig": [ "Enabled" ], "services": [ "Enabled" ], "windowsRegistry": [ "" ], "windowsRoles": [ "Enabled" ], "windowsUpdates": [ "Enabled" ] }, "AssociationId": "8dfe3659-4309-493a-8755-0123456789ab", "Targets": [ { "Key": "InstanceIds", "Values": [ "*" ] } ], "ScheduleExpression": "rate(24 hours)", "LastExecutionDate": 1550501886.0, "LastSuccessfulExecutionDate": 1550501886.0, "AssociationName": "Inventory-Association" } }

有关更多信息,请参阅《AWS Systems Manager 用户指南》中的编辑和创建关联的新版本

示例 2:获取特定实例和文档的关联的详细信息

以下 describe-association 示例描述实例和文档之间的关联。

aws ssm describe-association \ --instance-id "i-1234567890abcdef0" \ --name "AWS-UpdateSSMAgent"

输出:

{ "AssociationDescription": { "Status": { "Date": 1487876122.564, "Message": "Associated with AWS-UpdateSSMAgent", "Name": "Associated" }, "Name": "AWS-UpdateSSMAgent", "InstanceId": "i-1234567890abcdef0", "Overview": { "Status": "Pending", "DetailedStatus": "Associated", "AssociationStatusAggregatedCount": { "Pending": 1 } }, "AssociationId": "d8617c07-2079-4c18-9847-1234567890ab", "DocumentVersion": "$DEFAULT", "LastUpdateAssociationDate": 1487876122.564, "Date": 1487876122.564, "Targets": [ { "Values": [ "i-1234567890abcdef0" ], "Key": "InstanceIds" } ] } }

有关更多信息,请参阅《AWS Systems Manager 用户指南》中的编辑和创建关联的新版本

  • 有关 API 详细信息,请参阅《AWS CLI Command Reference》中的 DescribeAssociation

PowerShell
适用于 PowerShell 的工具

示例 1:此示例描述实例和文档之间的关联。

Get-SSMAssociation -InstanceId "i-0000293ffd8c57862" -Name "AWS-UpdateSSMAgent"

输出:

Name : AWS-UpdateSSMAgent InstanceId : i-0000293ffd8c57862 Date : 2/23/2017 6:55:22 PM Status.Name : Pending Status.Date : 2/20/2015 8:31:11 AM Status.Message : temp_status_change Status.AdditionalInfo : Additional-Config-Needed
  • 有关 API 详细信息,请参阅《AWS Tools for PowerShell Cmdlet Reference》中的 DescribeAssociation

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