

Amazon Snowball Edge is no longer available to new customers. New customers should explore [Amazon DataSync](https://aws.amazon.com/datasync/) for online transfers, [Amazon Data Transfer Terminal](https://aws.amazon.com/data-transfer-terminal/) for secure physical transfers, or Amazon Partner solutions. For edge computing, explore [Amazon Outposts](https://aws.amazon.com/outposts/). 

# Creating and managing an object lifecycle configuration using the Amazon CLI
<a name="working-s3-snow-buckets-lifecycle-s3-snow"></a>

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](https://docs.amazonaws.cn/AmazonS3/latest/userguide/object-lifecycle-mgmt.html).

**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
<a name="put-s3-snow-example"></a>

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**  

```
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](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3api/put-bucket-lifecycle-configuration.html) in the Amazon CLI Command Reference.

```
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](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3control/put-bucket-lifecycle-configuration.html) in the Amazon CLI Command Reference.