Utilizzo di ListInventoryEntries con una CLI - AWS Systems Manager

AWS Systems ManagerChange Managernon è più aperto a nuovi clienti. I clienti esistenti possono continuare a utilizzare il servizio normalmente. Per ulteriori informazioni, consulta AWS Systems ManagerChange Managerla pagina Modifica della disponibilità.

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

Utilizzo di ListInventoryEntries con una CLI

Gli esempi di codice seguenti mostrano come utilizzare ListInventoryEntries.

CLI
AWS CLI

Esempio 1: per visualizzare le voci relative al tipo di inventario specifiche per un'istanza

L'list-inventory-entriesesempio seguente elenca le voci di inventario per il tipo di AWS inventario:Application su un'istanza specifica.

aws ssm list-inventory-entries \ --instance-id "i-1234567890abcdef0" \ --type-name "AWS:Application"

Output:

{ "TypeName": "AWS:Application", "InstanceId": "i-1234567890abcdef0", "SchemaVersion": "1.1", "CaptureTime": "2019-02-15T12:17:55Z", "Entries": [ { "Architecture": "i386", "Name": "Amazon SSM Agent", "PackageId": "{88a60be2-89a1-4df8-812a-80863c2a2b68}", "Publisher": "Amazon Web Services", "Version": "2.3.274.0" }, { "Architecture": "x86_64", "InstalledTime": "2018-05-03T13:42:34Z", "Name": "AmazonCloudWatchAgent", "Publisher": "", "Version": "1.200442.0" } ] }

Esempio 2: come visualizzare le voci di inventario personalizzate assegnate a un’istanza

L'esempio seguente list-inventory-entries elenca una voce di inventario personalizzata assegnata a un'istanza.

aws ssm list-inventory-entries \ --instance-id "i-1234567890abcdef0" \ --type-name "Custom:RackInfo"

Output:

{ "TypeName": "Custom:RackInfo", "InstanceId": "i-1234567890abcdef0", "SchemaVersion": "1.0", "CaptureTime": "2021-05-22T10:01:01Z", "Entries": [ { "RackLocation": "Bay B/Row C/Rack D/Shelf E" } ] }
PowerShell
Strumenti per PowerShell V4

Esempio 1: questo esempio elenca tutte le voci di inventario personalizzate per un'istanza.

Get-SSMInventoryEntriesList -InstanceId "i-0cb2b964d3e14fd9f" -TypeName "Custom:RackInfo"

Output:

CaptureTime : 2016-08-22T10:01:01Z Entries : {Amazon.Runtime.Internal.Util.AlwaysSendDictionary`2[System.String,System.String]} InstanceId : i-0cb2b964d3e14fd9f NextToken : SchemaVersion : 1.0 TypeName : Custom:RackInfo

Esempio 2: questo esempio elenca i dettagli.

(Get-SSMInventoryEntriesList -InstanceId "i-0cb2b964d3e14fd9f" -TypeName "Custom:RackInfo").Entries

Output:

Key Value --- ----- RackLocation Bay B/Row C/Rack D/Shelf E
  • Per i dettagli sull'API, vedere ListInventoryEntriesin AWS Strumenti per PowerShell Cmdlet Reference (V4).

Strumenti per V5 PowerShell

Esempio 1: questo esempio elenca tutte le voci di inventario personalizzate per un'istanza.

Get-SSMInventoryEntriesList -InstanceId "i-0cb2b964d3e14fd9f" -TypeName "Custom:RackInfo"

Output:

CaptureTime : 2016-08-22T10:01:01Z Entries : {Amazon.Runtime.Internal.Util.AlwaysSendDictionary`2[System.String,System.String]} InstanceId : i-0cb2b964d3e14fd9f NextToken : SchemaVersion : 1.0 TypeName : Custom:RackInfo

Esempio 2: questo esempio elenca i dettagli.

(Get-SSMInventoryEntriesList -InstanceId "i-0cb2b964d3e14fd9f" -TypeName "Custom:RackInfo").Entries

Output:

Key Value --- ----- RackLocation Bay B/Row C/Rack D/Shelf E
  • Per i dettagli sull'API, vedere ListInventoryEntriesin AWS Strumenti per PowerShell Cmdlet Reference (V5).

Per un elenco completo delle guide per sviluppatori AWS SDK e degli esempi di codice, consulta. Utilizzo di questo servizio con un AWS SDK Questo argomento include anche informazioni su come iniziare e dettagli sulle versioni precedenti dell'SDK.