View a markdown version of this page

Gunakan ListAssociationVersionsdengan CLI - AWS Contoh Kode SDK

Ada lebih banyak contoh AWS SDK yang tersedia di repo Contoh SDK AWS Doc. GitHub

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

Gunakan ListAssociationVersionsdengan CLI

Contoh kode berikut menunjukkan cara menggunakanListAssociationVersions.

CLI
AWS CLI

Untuk mencantumkan semua versi asosiasi untuk ID asosiasi tertentu

list-association-versionsContoh berikut mencantumkan semua versi asosiasi yang ditentukan.

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

Output:

{ "AssociationVersions": [ { "AssociationId": "8dfe3659-4309-493a-8755-0123456789ab", "AssociationVersion": "1", "CreatedDate": 1550505536.726, "Name": "AWS-UpdateSSMAgent", "Parameters": { "allowDowngrade": [ "false" ], "version": [ "" ] }, "Targets": [ { "Key": "InstanceIds", "Values": [ "i-1234567890abcdef0" ] } ], "ScheduleExpression": "cron(0 00 12 ? * SUN *)", "AssociationName": "UpdateSSMAgent" } ] }

Untuk informasi selengkapnya, lihat Bekerja dengan asosiasi di Systems Manager di Panduan Pengguna AWS Systems Manager.

PowerShell
Alat untuk PowerShell V4

Contoh 1: Contoh ini mengambil semua versi asosiasi yang disediakan.

Get-SSMAssociationVersionList -AssociationId 123a45a0-c678-9012-3456-78901234db5e

Output:

AssociationId : 123a45a0-c678-9012-3456-78901234db5e AssociationName : AssociationVersion : 2 ComplianceSeverity : CreatedDate : 3/12/2019 9:21:01 AM DocumentVersion : MaxConcurrency : MaxErrors : Name : AWS-GatherSoftwareInventory OutputLocation : Parameters : {} ScheduleExpression : Targets : {InstanceIds} AssociationId : 123a45a0-c678-9012-3456-78901234db5e AssociationName : test-case-1234567890 AssociationVersion : 1 ComplianceSeverity : CreatedDate : 3/2/2019 8:53:29 AM DocumentVersion : MaxConcurrency : MaxErrors : Name : AWS-GatherSoftwareInventory OutputLocation : Parameters : {} ScheduleExpression : rate(30minutes) Targets : {InstanceIds}
Alat untuk PowerShell V5

Contoh 1: Contoh ini mengambil semua versi asosiasi yang disediakan.

Get-SSMAssociationVersionList -AssociationId 123a45a0-c678-9012-3456-78901234db5e

Output:

AssociationId : 123a45a0-c678-9012-3456-78901234db5e AssociationName : AssociationVersion : 2 ComplianceSeverity : CreatedDate : 3/12/2019 9:21:01 AM DocumentVersion : MaxConcurrency : MaxErrors : Name : AWS-GatherSoftwareInventory OutputLocation : Parameters : {} ScheduleExpression : Targets : {InstanceIds} AssociationId : 123a45a0-c678-9012-3456-78901234db5e AssociationName : test-case-1234567890 AssociationVersion : 1 ComplianceSeverity : CreatedDate : 3/2/2019 8:53:29 AM DocumentVersion : MaxConcurrency : MaxErrors : Name : AWS-GatherSoftwareInventory OutputLocation : Parameters : {} ScheduleExpression : rate(30minutes) Targets : {InstanceIds}