Utilizzare ListDocuments con un o AWS SDK CLI - Esempi di codice dell'AWS SDK

Ci sono altri AWS SDK esempi disponibili nel repository AWS Doc SDK Examples GitHub .

Le traduzioni sono generate tramite traduzione automatica. In caso di conflitto tra il contenuto di una traduzione e la versione originale in Inglese, quest'ultima prevarrà.

Utilizzare ListDocuments con un o AWS SDK CLI

I seguenti esempi di codice mostrano come utilizzareListDocuments.

CLI
AWS CLI

Esempio 1: elencare i documenti

L'list-documentsesempio seguente elenca i documenti di proprietà dell'account richiedente contrassegnati con il tag personalizzato.

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" } ] } ] }

Per ulteriori informazioni, vedere AWS i documenti di Systems Manager nella Guida per l'utente di AWS Systems Manager.

Esempio 2: per elencare i documenti condivisi

L'list-documentsesempio seguente elenca i documenti condivisi, inclusi i documenti privati condivisi non di proprietà di 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": [] } ] }

Per ulteriori informazioni, vedere AWS i documenti di Systems Manager nella Guida per l'utente di AWS Systems Manager.

  • Per API i dettagli, vedere ListDocumentsin AWS CLI Command Reference.

PowerShell
Strumenti per PowerShell

Esempio 1: elenca tutti i documenti di configurazione del tuo account.

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 ...

Esempio 2: Questo esempio recupera tutti i documenti di automazione il cui nome corrisponde a '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 :
  • Per API i dettagli, vedere ListDocumentsin AWS Tools for PowerShell Cmdlet Reference.