搭配使用 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 使用者指南》中的 Editing and creating a new version of an association。
範例 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 使用者指南》中的 Editing and creating a new version of an association。
-
如需 API 詳細資訊,請參閱《AWS CLI 命令參考》中的 DescribeAssociation
。
-
- PowerShell
-
- Tools 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。
-
如需完整的 AWS SDK 開發人員指南和程式碼範例清單,請參閱透過 AWS SDK 使用此服務。此主題也包含有關入門的資訊和舊版 SDK 的詳細資訊。
DescribeActivations
DescribeAssociationExecutionTargets