Creating and managing an object lifecycle configuration using the Amazon CLI - Amazon Snowball Edge Developer Guide
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).

Creating and managing an object lifecycle configuration using the Amazon CLI

You can use Amazon S3 Lifecycle to optimize storage capacity for Amazon S3 compatible storage on Snowball Edge. You can create lifecycle rules to expire objects as they age or are replaced by newer versions. You can create, enable, disable, or delete a lifecycle rule. For more information about Amazon S3 Lifecycle, see Managing your storage lifecycle.

Note

The Amazon Web Services account that creates the bucket owns it and is the only one that can create, enable, disable, or delete a lifecycle rule.

To create and manage a lifecycle configuration for an Amazon S3 compatible storage on Snowball Edge bucket using the Amazon Command Line Interface (Amazon CLI), see the following examples.

PUT a lifecycle configuration on a Snowball Edge bucket

The following Amazon CLI example puts a lifecycle configuration policy on a Snowball Edge bucket. This policy specifies that all objects that have the flagged prefix (myprefix) and tags expire after 10 days. To use this example, replace each user input placeholder with your own information.

First, save the lifecycle configuration policy to a JSON file. For this example, the file is named lifecycle-example.json.

{ "Rules": [{ "ID": "id-1", "Filter": { "And": { "Prefix": "myprefix", "Tags": [{ "Value": "mytagvalue1", "Key": "mytagkey1" }, { "Value": "mytagvalue2", "Key": "mytagkey2" } ] } }, "Status": "Enabled", "Expiration": { "Days": 10 } }] }

After you save the file, submit the JSON file as part of the put-bucket-lifecycle-configuration command. To use this command, replace each user input placeholder with your own information.

Example of put-bucket-lifecycle command
s3api syntax
aws s3api put-bucket-lifecycle-configuration --bucket example-snow-bucket \\ --lifecycle-configuration file://lifecycle-example.json --endpoint-url https://s3api-endpoint-ip --profile your-profile

For more information about this command, see put-bucket-lifecycle-configuration in the Amazon CLI Command Reference.

s3control syntax
aws s3control put-bucket-lifecycle-configuration --bucket example-snow-bucket \\ --lifecycle-configuration file://lifecycle-example.json \\ --endpoint-url https://s3ctrlapi-endpoint-ip --profile your-profile

For more information about this command, see put-bucket-lifecycle-configuration in the Amazon CLI Command Reference.