GetBucketInventoryConfiguration与 AWS SDK 或 CLI 配合使用 - AWS SDK 代码示例

文档 AWS SDK 示例 GitHub 存储库中还有更多 S AWS DK 示例

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

GetBucketInventoryConfiguration与 AWS SDK 或 CLI 配合使用

以下代码示例演示如何使用 GetBucketInventoryConfiguration

CLI
AWS CLI

检索存储桶的清单配置

以下 get-bucket-inventory-configuration 示例检索 ID 为 1 的指定存储桶的清单配置。

aws s3api get-bucket-inventory-configuration \ --bucket my-bucket \ --id 1

输出:

{ "InventoryConfiguration": { "IsEnabled": true, "Destination": { "S3BucketDestination": { "Format": "ORC", "Bucket": "arn:aws:s3:::my-bucket", "AccountId": "123456789012" } }, "IncludedObjectVersions": "Current", "Id": "1", "Schedule": { "Frequency": "Weekly" } } }
PowerShell
用于 PowerShell

示例 1:此命令返回给定 S3 存储桶的名为“testinventory”的清单的详细信息。

Get-S3BucketInventoryConfiguration -BucketName 's3testbucket' -InventoryId 'testinventory'