Setting Up Lifecycle Policies on the S3 Bucket
S3 lifecycle policies could be very helpful if you are looking for a solution to automatically perform different kinds of actions on the objects you store inside your bucket.
In this lab step, you will define a lifecycle policy for your S3 bucket, it will let objects expire after 90 days and will move objects older than 30 days from the Standard storage class to the One Zone-IA.
1. Move to the Management tab of your bucket, and look at the Lifecycle Rules section:
2. Click on Create lifecycle rule to start the creation of the rule.
You will see there are other different actions you can set to be performed on the objects than the two you will implement, such as deleting old versions of an object and move old versions of an object between different storage classes.
3. Fill the creation form as described below (leave the unmentioned fields at their default values):
- Lifecycle rule configurationLifecycle rule name: expire-policy
- Choose a rule scope: Select Apply to all objects in the bucket, Check the I acknowledge that this rule will apply to all objects in the bucket checkbox
- Lifecycle rule actions: Check both the Move current versions of objects between storage classes and Expire current versions of objects checkboxes
- Transition current versions of objects between storage classes: Select One Zone-IA under Chose storage class transitions
- Days after object creation: 30
- Expire current versions of objectsExpire current versions of objects: 90
You have set up two different actions associated with the same lifecycle rule policy.
4. Click on Create rule to create the lifecycle policy rule.
You will see the rule you just created with the related actions:
The minimum time before an action is performed is 30 days, so you can't see the result of this action within this lab.
In this lab step, you defined a lifecycle policy for your S3 bucket.
If you want to learn more about S3 object transitions, you can follow the link to the official docs.
Check whether the Lifecycle policy has been created.