DescribeAssociation与 a 一起使用 CLI - AWS SDK代码示例

AWS 文档 AWS SDK示例 GitHub 存储库中还有更多SDK示例

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

DescribeAssociation与 a 一起使用 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 用户指南》中的编辑和创建关联的新版本

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 参考DescribeAssociation中的。