Creating a Basic Amazon S3 Lifecycle Policy

Hands-On Lab

 

Photo of Tia  Williams

Tia Williams

AWS Training Architect II in Content

Length

00:15:00

Difficulty

Beginner

Data is often useful for a limited period of time, during which it is accessed frequently. Once that period of usefulness has passed, though, the data is kept just in case it needs to be reviewed later. This type of data can be archived — and archive storage is typically more cost-effective. AWS offers Glacier as a long-term archive storage service with lower costs than other storage options. Data can be moved automatically between S3 storage classes using a lifecycle policy. In this hands-on lab, we will create a lifecycle policy. For the latest on AWS S3, see the information on Amazon S3 storage classes.

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.

Creating a Basic Amazon S3 Lifecycle Policy

Introduction

AWS offers Glacier as a long-term archive storage service with lower costs than other storage options. Data can be moved automatically between S3 storage classes using a lifecycle policy. In this hands-on lab, we will create a lifecycle policy.

Solution

Log in to the AWS Management Console using the credentials provided on the lab instructions page. Make sure you're using the us-east-1 region.

Feel free to download the pinehead.jpg file if you'd like to upload it to the folder we'll create.

Create an S3 Bucket and Upload an Object

  1. Navigate to S3.
  2. Click + Create bucket.
  3. For Bucket name, type "lalifecycle". (Since bucket names must be globally unique, add a series of random numbers at the end.) Click Next.
  4. On the properties screen, check the box to enable versioning, and click Next.
  5. On the permissions screen, ensure none of the checkmarks are selected — this includes individual ones and any group check mark.
  6. Click Next, and then click Create bucket.
  7. Click the name of the bucket to open it, and then click + Create folder.
  8. Name the folder "MyProject", and click Save.
  9. Open the folder, and click Upload.
  10. Upload any file you'd like (which could be the pinehead.jpg file if you downloaded that from GitHub).
  11. Click Next.
  12. Set Manage public permissions to Grant public read access to this object(s).
  13. Click Next, Next, and then Upload.

Create a Lifecycle Policy

  1. Click the bucket name at the top of the page.
  2. Select the Management tab.
  3. Click + Add lifecycle rule.
  4. Name the rule "s3toGlacier", and click Next.
  5. On the Storage class transition screen, check the boxes next to Current version and Previous versions.
  6. Next to For current versions of objects, click + Add transition, and set the following values:
    • Object creation: Transition to Glacier after
    • Days after creation: 30 days
  7. Next to For previous versions of objects, click + Add transition, and set the following values:
    • Object creation: Transition to Glacier Deep Archive after
    • Days after creation: 15 days
  8. Click Next.
  9. On the Configure expiration screen, check Previous versions.
  10. With Permanently delete previous versions checked, type "365" in to indicate they should delete after 365 days from becoming a previous version.
  11. Click Next, and then Save.

Conclusion

Congratulations on completing this hands-on lab!