Using Amazon S3 Storage Lens configurations with the AWS CLI - Amazon Simple Storage Service

Using Amazon S3 Storage Lens configurations with the AWS CLI

You can use the AWS CLI to list, create, delete, get, tag, and update your S3 Storage Lens configurations. The following examples use the helper JSON files for key inputs. To use these examples, replace the user input placeholders with your own information.

Create an S3 Storage Lens configuration

Example Create an S3 Storage Lens configuration
aws s3control put-storage-lens-configuration --account-id=111122223333 --config-id=example-dashboard-configuration-id --region=us-east-1 --storage-lens-configuration=file://./config.json --tags=file://./tags.json

Create an S3 Storage Lens configuration without tags

Example Create an S3 Storage Lens configuration without tags
aws s3control put-storage-lens-configuration --account-id=222222222222 --config-id=your-configuration-id --region=us-east-1 --storage-lens-configuration=file://./config.json

Get an S3 Storage Lens configuration

Example Get an S3 Storage Lens configuration
aws s3control get-storage-lens-configuration --account-id=222222222222 --config-id=your-configuration-id --region=us-east-1

List S3 Storage Lens configurations without a next token

Example List S3 Storage Lens configurations without a next token
aws s3control list-storage-lens-configurations --account-id=222222222222 --region=us-east-1

List S3 Storage Lens configurations

Example List S3 Storage Lens configurations
aws s3control list-storage-lens-configurations --account-id=222222222222 --region=us-east-1 --next-token=abcdefghij1234

Delete an S3 Storage Lens configuration

Example Delete an S3 Storage Lens configuration
aws s3control delete-storage-lens-configuration --account-id=222222222222 --region=us-east-1 --config-id=your-configuration-id

Add tags to an S3 Storage Lens configuration

Example Add tags to an S3 Storage Lens configuration
aws s3control put-storage-lens-configuration-tagging --account-id=222222222222 --region=us-east-1 --config-id=your-configuration-id --tags=file://./tags.json

Get tags for an S3 Storage Lens configuration

Example Get tags for an S3 Storage Lens configuration
aws s3control get-storage-lens-configuration-tagging --account-id=222222222222 --region=us-east-1 --config-id=your-configuration-id

Delete tags for an S3 Storage Lens configuration

Example Delete tags for an S3 Storage Lens configuration
aws s3control delete-storage-lens-configuration-tagging --account-id=222222222222 --region=us-east-1 --config-id=your-configuration-id