Using Amazon S3 Storage Lens configurations with the Amazon CLI - Amazon Simple Storage Service
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).

Using Amazon S3 Storage Lens configurations with the Amazon CLI

You can use the Amazon 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