AWS::S3::StorageLens - Amazon CloudFormation
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

AWS::S3::StorageLens

The AWS::S3::StorageLens resource creates an Amazon S3 Storage Lens configuration.

Syntax

To declare this entity in your Amazon CloudFormation template, use the following syntax:

JSON

{ "Type" : "AWS::S3::StorageLens", "Properties" : { "StorageLensConfiguration" : StorageLensConfiguration, "Tags" : [ Tag, ... ] } }

YAML

Type: AWS::S3::StorageLens Properties: StorageLensConfiguration: StorageLensConfiguration Tags: - Tag

Properties

StorageLensConfiguration

This resource contains the details Amazon S3 Storage Lens configuration.

Required: Yes

Type: StorageLensConfiguration

Update requires: No interruption

Tags

A set of tags (key–value pairs) to associate with the Storage Lens configuration.

Required: No

Type: Array of Tag

Maximum: 50

Update requires: No interruption

Return values

Ref

When the logical ID of this resource is provided to the Ref intrinsic function, Ref returns the S3 Storage Lens configuration Id, such as your-storage-lens-configuration-id. For more information about using the Ref function, see Ref.

Fn::GetAtt

Fn::GetAtt returns a value for a specified attribute of this type. For more information, see Fn::GetAtt. The following are the available attributes and sample return values.

StorageLensConfiguration.StorageLensArn

This property contains the details of the ARN of the S3 Storage Lens configuration. This property is read-only.

Examples

The following examples create an advanced S3 Storage Lens configuration that enables advanced metrics, Amazon CloudWatch publishing, and prefix aggregation. This example also configures a metrics export and adds tags.

Creating an advanced S3 Storage Lens configuration

JSON

{ "AWSTemplateFormatVersion": "2010-09-09", "Description": "StorageLens Advanced Configuration Example", "Resources": { "StorageLensConfigurationExample": { "Type": "AWS::S3::StorageLens", "Properties": { "StorageLensConfiguration": { "Id": "StorageLensAdvancedConfiguration", "AccountLevel": { "ActivityMetrics": { "IsEnabled": true }, "AdvancedCostOptimizationMetrics": { "IsEnabled": true }, "AdvancedDataProtectionMetrics": { "IsEnabled": true }, "DetailedStatusCodesMetrics": { "IsEnabled": true }, "BucketLevel": { "ActivityMetrics": { "IsEnabled": true }, "AdvancedCostOptimizationMetrics": { "IsEnabled": true }, "AdvancedDataProtectionMetrics": { "IsEnabled": true }, "DetailedStatusCodesMetrics": { "IsEnabled": true }, "PrefixLevel": { "StorageMetrics": { "IsEnabled": true, "SelectionCriteria": { "MaxDepth": 5, "MinStorageBytesPercentage": 1.23, "Delimiter": "/" } } } } }, "Exclude": { "Buckets": [ { "Fn::Sub": "arn:aws:s3:::source_bucket_1" }, { "Fn::Sub": "arn:aws:s3:::source_bucket_2" } ] }, "IsEnabled": true, "DataExport": { "S3BucketDestination": { "OutputSchemaVersion": "V_1", "Format": "CSV", "AccountId": "111122223333", "Arn": { "Fn::Sub": "arn:aws:s3:::destination_bucket" }, "Prefix": "output-path-prefix", "Encryption": { "SSES3": {} } }, "CloudWatchMetrics": { "IsEnabled": true } } }, "Tags": [ { "Key": "tag-key-1", "Value": "tag-value-1" }, { "Key": "tag-key-2", "Value": "tag-value-2" } ] } } } }

YAML

AWSTemplateFormatVersion: 2010-09-09 Description: StorageLens Advanced Configuration Example Resources: StorageLensConfigurationExample: Type: AWS::S3::StorageLens Properties: StorageLensConfiguration: Id: "StorageLensAdvancedConfiguration" AccountLevel: ActivityMetrics: IsEnabled: true AdvancedCostOptimizationMetrics: IsEnabled: true AdvancedDataProtectionMetrics: IsEnabled: true DetailedStatusCodesMetrics: IsEnabled: true BucketLevel: ActivityMetrics: IsEnabled: true AdvancedCostOptimizationMetrics: IsEnabled: true AdvancedDataProtectionMetrics: IsEnabled: true DetailedStatusCodesMetrics: IsEnabled: true PrefixLevel: StorageMetrics: IsEnabled: true SelectionCriteria: MaxDepth: 5 MinStorageBytesPercentage: 1.23 Delimiter: "/" Exclude: Buckets: - !Sub 'arn:aws:s3:::source_bucket_1' - !Sub 'arn:aws:s3:::source_bucket_2' IsEnabled: true DataExport: S3BucketDestination: OutputSchemaVersion: "V_1" Format: "CSV" AccountId: "111122223333" Arn: !Sub 'arn:aws:s3:::destination_bucket' Prefix: "output-path-prefix" Encryption: SSES3: {} CloudWatchMetrics: IsEnabled: true Tags: - Key: "tag-key-1" Value: "tag-value-1" - Key: "tag-key-2" Value: "tag-value-2"