Ada lebih banyak contoh AWS SDK yang tersedia di repo Contoh SDK AWS Doc
Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.
Gunakan ListInventoryEntries dengan CLI
Contoh kode berikut menunjukkan cara menggunakanListInventoryEntries.
- CLI
-
- AWS CLI
-
Contoh 1: Untuk melihat entri jenis inventaris tertentu untuk sebuah instance
list-inventory-entriesContoh berikut ini mencantumkan entri inventaris untuk jenis AWS inventaris:Aplikasi pada instance tertentu.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" } ] }Contoh 2: Untuk melihat entri inventaris kustom yang ditetapkan ke sebuah instance
list-inventory-entriesContoh berikut mencantumkan entri inventaris kustom yang ditetapkan ke sebuah instance.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" } ] }-
Untuk detail API, lihat ListInventoryEntries
di Referensi AWS CLI Perintah.
-
- PowerShell
-
- Alat untuk PowerShell V4
-
Contoh 1: Contoh ini mencantumkan semua entri inventaris kustom untuk sebuah instance.
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:RackInfoContoh 2: Contoh ini mencantumkan detailnya.
(Get-SSMInventoryEntriesList -InstanceId "i-0cb2b964d3e14fd9f" -TypeName "Custom:RackInfo").EntriesOutput:
Key Value --- ----- RackLocation Bay B/Row C/Rack D/Shelf E-
Untuk detail API, lihat ListInventoryEntriesdi Referensi Alat AWS untuk PowerShell Cmdlet (V4).
-
- Alat untuk PowerShell V5
-
Contoh 1: Contoh ini mencantumkan semua entri inventaris kustom untuk sebuah instance.
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:RackInfoContoh 2: Contoh ini mencantumkan detailnya.
(Get-SSMInventoryEntriesList -InstanceId "i-0cb2b964d3e14fd9f" -TypeName "Custom:RackInfo").EntriesOutput:
Key Value --- ----- RackLocation Bay B/Row C/Rack D/Shelf E-
Untuk detail API, lihat ListInventoryEntriesdi Referensi Alat AWS untuk PowerShell Cmdlet (V5).
-