Skip to main content

S3 Data Management with Versioning and Lifecycle Rules

Hands-On Lab

 

Photo of

Training Architect

Length

00:30:00

Difficulty

Intermediate

Welcome to this hands-on AWS Learning Activity for configuring S3 Versioning and Lifecycle Rules. This activity provides you with the opportunity to get hands-on experience configuring the following in S3: 1) Enable Versioning on an S3 Bucket 2) Configure lifecycle rules to automatically transition objects to lower-cost storage classes 3) Change image files to reduced redundancy storage as the organization has means to recreate them if they are lost. Understanding and utilizing these two S3 features are at the core of S3 data management. Common use cases for the features include the fact that versioning helps to prevent accidental deletions, and lifecycle policies allow for automated migration to lower cost storage classes when appropriate. Good luck and enjoy the Learning Activity!

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

S3 Data Management with Versioning and Lifecycle Rules

Introduction

In this lab, you'll get hands-on experience in the following:

  • Enabling versioning on an S3 bucket
  • Configuring lifecycle rules to automatically transition objects to lower-cost storage classes
  • Changing image files to reduced redundancy storage

Log in to the live environment with the cloud_user credentials provided on the lab instructions page.

Make sure you are using us-east-1 (N. Virginia) as your region throughout the lab.

Note: For helpful information, including the latest updates, check out the following AWS documentation:

Enabling Versioning and Configuring Lifecycle Rules

Enable Versioning on the Provided S3 Bucket

The first step is to enable versioning on our S3 bucket. Let's get started.

  1. Navigate to the S3 service, and click on the bucket in the list.
  2. Click the Properties tab.
  3. Click on the Versioning box.
  4. Select Enable versioning.
  5. Click Save.

Assign a Lifecycle Rule to Objects in the Logs Folder

Next, we'll assign a lifecycle policy to objects in the Logs folder to move them to infrequently accessed (S3-IA) storage after 90 days.

  1. Navigate to the Management tab of the bucket.
  2. Click Add lifecycle rule.
  3. On the Name and scope page, enter a name for the rule (e.g., "LogRule").
  4. In the prefix/tags box, add a prefix of "Logs" so the rule applies to objects in the Logs folder.
  5. Click Next.
  6. On the Transitions page, check the box next to Current version.
  7. Click Add transition.
  8. Under Object creation, select Transition to Standard-IA after from the dropdown.
  9. Under Days after creation, enter "90".
  10. Click Next.
  11. Object expirations are not necessary for this scenario, so leave the defaults on the Expiration page, and click Next.
  12. On the Review page, click Save.

Change the File in the Images Folder to Reduced Redundancy Storage

Reduced redundancy is not part of lifecycle rules — we have to configure it separately. Let's do that now.

  1. Open the Images folder.
  2. Check the box beside the Image1.png object to select it.
  3. Click More.
  4. Choose the Change storage class option from the dropdown.
  5. Select Reduced redundancy, and then click Save.
  6. Click Change.

Add a Lifecycle Rule to Move the Old Log Object After 180 Days

For this last step, we're going to move one of the objects, so we can't use a prefix — we have to use tags instead.

  1. Open the Logs folder in the bucket.
  2. Check the box beside 2016.csv to select it.
  3. Click More.
  4. Choose the Add tags option from the dropdown.
  5. Enter "Type" for Key and "OldLogs" for Value.
  6. Click Save, and then Save Tags.
  7. Go back to the bucket home page, and choose the Management tab.
  8. Click Add lifecycle rule.
  9. On the Name and scope page, enter a name for the rule (e.g., "OldLogs").
  10. In the prefix/tags box, type "Type" and click tag Type from the dropdown.
  11. Add "OldLogs" after the pipe. (The result should look like this: tag Type | OldLogs.)
  12. Press Enter.
  13. Click Next.
  14. On the Transitions page, check the box next to Current version.
  15. Click Add transition.
  16. Under Object creation, choose Transition to Amazon Glacier after from the dropdown.
  17. Under Days after creation, enter "180".
  18. Leave the defaults on the Expiration page, and click Next.
  19. On the Review page, click Save.

Conclusion

Congratulations on completing this lab!