搭配使用 GetBucketInventoryConfiguration 與 CLI - AWS SDK 程式碼範例

AWS文件開發套件範例 GitHub 儲存庫中有更多可用的 AWS SDK 範例。

搭配使用 GetBucketInventoryConfiguration 與 CLI

下列程式碼範例示範如何使用 GetBucketInventoryConfiguration

CLI
AWS CLI

擷取儲存貯體的庫存組態

下列 get-bucket-inventory-configuration 範例會擷取 ID 為 1 之指定儲存貯體的庫存組態。

aws s3api get-bucket-inventory-configuration \ --bucket amzn-s3-demo-bucket \ --id 1

輸出:

{ "InventoryConfiguration": { "IsEnabled": true, "Destination": { "S3BucketDestination": { "Format": "ORC", "Bucket": "arn:aws:s3:::amzn-s3-demo-bucket", "AccountId": "123456789012" } }, "IncludedObjectVersions": "Current", "Id": "1", "Schedule": { "Frequency": "Weekly" } } }
PowerShell
Tools for PowerShell V4

範例 1:此命令會傳回給定 S3 儲存貯體之名為 'testinventory' 的庫存詳細資訊。

Get-S3BucketInventoryConfiguration -BucketName 'amzn-s3-demo-bucket' -InventoryId 'testinventory'
Tools for PowerShell V5

範例 1:此命令會傳回給定 S3 儲存貯體之名為 'testinventory' 的庫存詳細資訊。

Get-S3BucketInventoryConfiguration -BucketName 'amzn-s3-demo-bucket' -InventoryId 'testinventory'