使用 Amazon S3 Storage Lens 的 Helper 檔案 - Amazon Simple Storage Service

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

使用 Amazon S3 Storage Lens 的 Helper 檔案

使用下列JSON檔案及其金鑰輸入作為範例。

S3 Storage Lens 在 中的範例組態 JSON

範例 config.json

config.json 檔案包含 S3 Storage Lens 組織層級進階指標和建議組態的詳細資訊。若要使用下列範例,請以您自己的資訊取代 user input placeholders

注意

進階指標和建議需支付額外費用。如需詳細資訊,請參閱進階指標和建議

{ "Id": "SampleS3StorageLensConfiguration", //Use this property to identify your S3 Storage Lens configuration. "AwsOrg": { //Use this property when enabling S3 Storage Lens for AWS Organizations. "Arn": "arn:aws:organizations::123456789012:organization/o-abcdefgh" }, "AccountLevel": { "ActivityMetrics": { "IsEnabled":true }, "AdvancedCostOptimizationMetrics": { "IsEnabled":true }, "AdvancedDataProtectionMetrics": { "IsEnabled":true }, "DetailedStatusCodesMetrics": { "IsEnabled":true }, "BucketLevel": { "ActivityMetrics": { "IsEnabled":true }, "AdvancedDataProtectionMetrics": { "IsEnabled":true }, "AdvancedCostOptimizationMetrics": { "IsEnabled":true }, "DetailedStatusCodesMetrics": { "IsEnabled":true }, "PrefixLevel":{ "StorageMetrics":{ "IsEnabled":true, "SelectionCriteria":{ "MaxDepth":5, "MinStorageBytesPercentage":1.25, "Delimiter":"/" } } } } }, "Exclude": { //Replace with "Include" if you prefer to include Regions. "Regions": [ "eu-west-1" ], "Buckets": [ //This attribute is not supported for AWS Organizations-level configurations. "arn:aws:s3:::amzn-s3-demo-source-bucket" ] }, "IsEnabled": true, //Whether the configuration is enabled "DataExport": { //Details about the metrics export "S3BucketDestination": { "OutputSchemaVersion": "V_1", "Format": "CSV", //You can add "Parquet" if you prefer. "AccountId": "111122223333", "Arn": "arn:aws:s3::: amzn-s3-demo-destination-bucket", // The destination bucket for your metrics export must be in the same Region as your S3 Storage Lens configuration. "Prefix": "prefix-for-your-export-destination", "Encryption": { "SSES3": {} } }, "CloudWatchMetrics": { "IsEnabled": true } } }

S3 Storage Lens 範例組態搭配 中的 Storage Lens 群組 JSON

範例 config.json

config.json 檔案包含您在使用 Storage Lens 群組時要套用至 Storage Lens 組態的詳細資訊。若要使用該範例,請將 user input placeholders 取代為您自己的資訊。

若要將所有 Storage Lens 群組連接至儀表板,請使用下列語法更新您的 Storage Lens 組態:

{ "Id": "ExampleS3StorageLensConfiguration", "AccountLevel": { "ActivityMetrics": { "IsEnabled":true }, "AdvancedCostOptimizationMetrics": { "IsEnabled":true }, "AdvancedDataProtectionMetrics": { "IsEnabled":true }, "BucketLevel": { "ActivityMetrics": { "IsEnabled":true }, "StorageLensGroupLevel": {}, "IsEnabled": true }

在 Storage Lens 儀表板組態中僅包含兩個 Storage Lens 群組 (slg-1 以及 slg-2),請使用下列語法:

{ "Id": "ExampleS3StorageLensConfiguration", "AccountLevel": { "ActivityMetrics": { "IsEnabled":true }, "AdvancedCostOptimizationMetrics": { "IsEnabled":true }, "AdvancedDataProtectionMetrics": { "IsEnabled":true }, "BucketLevel": { "ActivityMetrics": { "IsEnabled":true }, "StorageLensGroupLevel": { "SelectionCriteria": { "Include": [ "arn:aws:s3:us-east-1:111122223333:storage-lens-group/slg-1", "arn:aws:s3:us-east-1:444455556666:storage-lens-group/slg-2" ] }, "IsEnabled": true }

若只有特定 Storage Lens 群組不要連接至儀表板組態,請使用下列語法:

{ "Id": "ExampleS3StorageLensConfiguration", "AccountLevel": { "ActivityMetrics": { "IsEnabled":true }, "AdvancedCostOptimizationMetrics": { "IsEnabled":true }, "AdvancedDataProtectionMetrics": { "IsEnabled":true }, "BucketLevel": { "ActivityMetrics": { "IsEnabled":true }, "StorageLensGroupLevel": { "SelectionCriteria": { "Exclude": [ "arn:aws:s3:us-east-1:111122223333:storage-lens-group/slg-1", "arn:aws:s3:us-east-1:444455556666:storage-lens-group/slg-2" ] }, "IsEnabled": true }

S3 Storage Lens 範例標籤組態位於 JSON

範例 tags.json

tags.json 檔案包含您想要套用至 S3 Storage Lens 組態的標籤。若要使用此範例,請以您自己的資訊取代 user input placeholders

[ { "Key": "key1", "Value": "value1" }, { "Key": "key2", "Value": "value2" } ]

S3 Storage Lens 範例組態IAM許可

範例 permissions.json - 特定儀表板名稱

此範例政策顯示指定特定儀表板名稱的 S3 Storage Lens IAM permissions.json 檔案。Replace (取代) value1your-dashboard-nameus-east-1example-account-id,使用您自己的值。

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:GetStorageLensConfiguration", "s3:DeleteStorageLensConfiguration", "s3:PutStorageLensConfiguration" ], "Condition": { "StringEquals": { "aws:ResourceTag/key1": "value1" } }, "Resource": "arn:aws:s3:us-east-1:example-account-id:storage-lens/your-dashboard-name" } ] }
範例 permissions.json - 沒有特定的儀表板名稱

此範例政策顯示未指定特定儀表板名稱的 S3 Storage Lens IAM permissions.json 檔案。Replace (取代) value1us-east-1example-account-id,使用您自己的值。

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "s3:GetStorageLensConfiguration", "s3:DeleteStorageLensConfiguration", "s3:PutStorageLensConfiguration" ], "Condition": { "StringEquals": { "aws:ResourceTag/key1": "value1" } }, "Resource": "arn:aws:s3:us-east-1:example-account-id:storage-lens/*" } ] }