Managing Data in S3 with Versioning and Lifecycle Rules

Hands-On Lab

 

Photo of Mark Richman

Mark Richman

AWS Training Architect II in Content

Length

00:30:00

Difficulty

Intermediate

In this hands-on lab, we'll configure the following in S3: 1. Enable versioning on an S3 bucket. 1. Configure lifecycle rules to automatically transition objects to lower-cost storage classes. 1. 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 include recovery from accidental deletions, and lifecycle policies allow for automated migration to lower cost storage classes when appropriate. Good luck, and enjoy the lab!

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.

Managing Data in S3 with Versioning and Lifecycle Rules

Introduction

In this hands-on lab, we'll configure 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.

Solution

Log in to the live AWS environment using the credentials provided. Make sure you're in the N. Virginia (us-east-1) region throughout the lab.

Enable Versioning on the Provided S3 Bucket

  1. Navigate to S3.
  2. In the Properties tab for the bucket, click on the Versioning box.
  3. Click the button beside Enable versioning.
  4. Click Save.

Assign a Lifecycle Rule to Objects in the Log Folder

  1. In the Management tab of the bucket, click Add lifecycle rule.
  2. Enter a name for the rule (e.g., "LogsRule").
  3. Add a prefix of "Logs".
  4. Click Next.
  5. On the Transitions screen, check Current version.
  6. Click Add transition, and set the following values:
    • Object creation: Transition to Standard-IA after
    • Days after creation: 90
  7. Click Next.
  8. Leave the expiration defaults, and click Next.
  9. Click Save.

Assign a Lifecycle Rule to Objects in the Images Folder

  1. Navigate to the Management tab of the bucket.
  2. Click Add lifecycle rule.
  3. Enter a name for the rule (e.g., "ImagesRule").
  4. Add a prefix of "Images".
  5. Click Next.
  6. On the Transitions screen, check Current version.
  7. Click Add transition, and set the following values:
    • Object creation: Transition to One Zone-IA after
    • Days after creation: 30
  8. Click Next.
  9. Leave the expiration defaults, and click Next.
  10. Click Save.

Add a Lifecycle Rule to Move the Older Log File to Glacier after 180 Days

  1. Click the Logs folder in the bucket.
  2. Check the box beside 2018.csv.
  3. Click Actions, and select Add tags.
  4. Set the following values:
    • Key: Type
    • Value: OldLogs
  5. Click Save, and then Save Tags.
  6. Go back to the bucket, and choose the Management tab.
  7. Click Add lifecycle rule.
  8. Enter a name for the rule (e.g., "TaggedImagesRule").
  9. In the prefix/tag box:
    • Type "Type", and click tag Type.
    • Press Enter.
    • Add "OldLogs" after the pipe.
    • Press Enter.
  10. The final result should look like: tag Type | OldLogs. Click Next.
  11. On the Transitions screen, check Current version.
  12. Click Add transition, and set the following values:
    • Object creation: Transition to Glacier after
    • Days after creation: 180
  13. Click Next.
  14. Leave the expiration defaults, and click Next.
  15. Click Save.

Conclusion

Congratulations on completing this hands-on lab!