Hands-On Mini Lab

S3 Versioning and Lifecycle Lab

Negligible for tiny test objects if cleaned up. Lifecycle transitions and retained versions can create charges if left behind.

Goal

Reinforce Buckets and objects, Versioning, Lifecycle rules, Encryption, Cleanup discipline through a small, inspectable activity.

Concepts Reinforced

  • Buckets and objects
  • Versioning
  • Lifecycle rules
  • Encryption
  • Cleanup discipline

Prerequisites

  • AWS CLI configured
  • Permission to create a test S3 bucket

Estimated Cost

Exact Steps

  1. Create a uniquely named bucket in one Region.
  2. Enable versioning on the bucket.
  3. Upload a small text object twice with different content.
  4. List object versions and observe that S3 retained both versions.
  5. Apply a lifecycle rule that expires noncurrent versions after a short test interval where allowed by your account policy.
Runnable example after replacing bucket name and Region
aws s3api create-bucket --bucket djames-study-example-111122223333 --region us-east-1
aws s3api put-bucket-versioning --bucket djames-study-example-111122223333 --versioning-configuration Status=Enabled
aws s3 cp ./note.txt s3://djames-study-example-111122223333/note.txt
aws s3api list-object-versions --bucket djames-study-example-111122223333 --prefix note.txt

Verification

  • aws s3api list-object-versions returns more than one version for the same key.
  • The lifecycle configuration is visible with get-bucket-lifecycle-configuration.

Cleanup Steps

  • Delete all object versions and delete markers.
  • Delete the bucket.

Sources and Review Metadata

This independent training application is not affiliated with or endorsed by Amazon Web Services. AWS, Amazon Web Services, and AWS certification names are trademarks of Amazon.com, Inc. or its affiliates.