文件 AWS SDK AWS 範例 SDK 儲存庫中有更多可用的
本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
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 命令參考中的 DescribeAssociation
。
-
- PowerShell
-
- for 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。
-
DescribeActivations
DescribeAssociationExecutionTargets