Gunakan ListDocuments dengan AWS SDK atau CLI - AWS SDKContoh Kode

Ada lebih banyak AWS SDK contoh yang tersedia di GitHub repo SDKContoh AWS Dokumen.

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

Gunakan ListDocuments dengan AWS SDK atau CLI

Contoh kode berikut menunjukkan cara menggunakanListDocuments.

CLI
AWS CLI

Contoh 1: Untuk daftar dokumen

list-documentsContoh berikut mencantumkan dokumen yang dimiliki oleh akun permintaan yang ditandai dengan tag kustom.

aws ssm list-documents \ --filters Key=Owner,Values=Self Key=tag:DocUse,Values=Testing

Output:

{ "DocumentIdentifiers": [ { "Name": "Example", "Owner": "29884EXAMPLE", "PlatformTypes": [ "Windows", "Linux" ], "DocumentVersion": "1", "DocumentType": "Automation", "SchemaVersion": "0.3", "DocumentFormat": "YAML", "Tags": [ { "Key": "DocUse", "Value": "Testing" } ] } ] }

Untuk informasi selengkapnya, lihat Dokumen AWS Systems Manager di Panduan Pengguna AWS Systems Manager.

Contoh 2: Untuk daftar dokumen bersama

list-documentsContoh berikut mencantumkan dokumen bersama, termasuk dokumen bersama pribadi yang tidak dimiliki oleh AWS.

aws ssm list-documents \ --filters Key=Name,Values=sharedDocNamePrefix Key=Owner,Values=Private

Output:

{ "DocumentIdentifiers": [ { "Name": "Example", "Owner": "12345EXAMPLE", "PlatformTypes": [ "Windows", "Linux" ], "DocumentVersion": "1", "DocumentType": "Command", "SchemaVersion": "0.3", "DocumentFormat": "YAML", "Tags": [] } ] }

Untuk informasi selengkapnya, lihat Dokumen AWS Systems Manager di Panduan Pengguna AWS Systems Manager.

  • Untuk API detailnya, lihat ListDocumentsdi Referensi AWS CLI Perintah.

PowerShell
Alat untuk PowerShell

Contoh 1: Daftar semua dokumen konfigurasi di akun Anda.

Get-SSMDocumentList

Output:

DocumentType : Command DocumentVersion : 1 Name : AWS-ApplyPatchBaseline Owner : Amazon PlatformTypes : {Windows} SchemaVersion : 1.2 DocumentType : Command DocumentVersion : 1 Name : AWS-ConfigureAWSPackage Owner : Amazon PlatformTypes : {Windows, Linux} SchemaVersion : 2.0 DocumentType : Command DocumentVersion : 1 Name : AWS-ConfigureCloudWatch Owner : Amazon PlatformTypes : {Windows} SchemaVersion : 1.2 ...

Contoh 2: Contoh ini mengambil semua dokumen otomatisasi dengan pencocokan nama 'Platform'

Get-SSMDocumentList -DocumentFilterList @{Key="DocumentType";Value="Automation"} | Where-Object Name -Match "Platform"

Output:

DocumentFormat : JSON DocumentType : Automation DocumentVersion : 7 Name : KT-Get-Platform Owner : 987654123456 PlatformTypes : {Windows, Linux} SchemaVersion : 0.3 Tags : {} TargetType : VersionName :
  • Untuk API detailnya, lihat ListDocumentsdi AWS Tools for PowerShell Referensi Cmdlet.