By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.
(For AWS Solutions Architect – Associate)
You’re a cloud engineer at a mid-sized SaaS company. Your team just migrated a legacy on-prem backup system to AWS, and now your CFO is freaking out—S3 costs are 3x higher than expected. The problem? Your team dumped everything into S3 Standard, but 80% of the data is old logs, backups, and compliance archives that are rarely accessed.
S3 Storage Classes are your cost-saving superpower. They let you automatically move data to cheaper tiers based on access patterns—without changing your application code. Get this wrong, and you’ll either: - Overspend (paying for high-performance storage for data you never touch), or - Break compliance (accidentally deleting or making data inaccessible when it’s needed).
Real-world scenario:You inherit a bucket with 50TB of data. Some files are accessed daily (user uploads), some monthly (audit logs), and some once a year (compliance archives). You need to optimize costs while keeping data available—without manually moving files.
s3:*
iam:PassRole
aws --version
test.txt
aws s3api create-bucket \ --bucket my-cost-optimized-bucket-$(date +%s) \ --region us-east-1 \ --create-bucket-configuration LocationConstraint=us-east-1
Why? Intelligent-Tiering is the safest default for unknown access patterns.
echo "This is a test file" > test.txt aws s3 cp test.txt s3://my-cost-optimized-bucket-123456789/
Verify:
aws s3 ls s3://my-cost-optimized-bucket-123456789/ --human-readable
Expected output:
2024-04-05 12:00:00 22 Bytes test.txt
Create lifecycle.json:
lifecycle.json
{ "Rules": [ { "ID": "MoveToGlacierAfter30Days", "Status": "Enabled", "Filter": {}, "Transitions": [ { "Days": 30, "StorageClass": "GLACIER" } ] } ] }
Apply the policy:
aws s3api put-bucket-lifecycle-configuration \ --bucket my-cost-optimized-bucket-123456789 \ --lifecycle-configuration file://lifecycle.json
aws s3api get-bucket-lifecycle-configuration --bucket my-cost-optimized-bucket-123456789
aws s3 cp s3://my-cost-optimized-bucket-123456789/test.txt s3://my-cost-optimized-bucket-123456789/test.txt \ --storage-class GLACIER
aws s3api head-object --bucket my-cost-optimized-bucket-123456789 --key test.txt
{ "StorageClass": "GLACIER", "LastModified": "2024-04-05T12:00:00+00:00" }
aws s3api restore-object \ --bucket my-cost-optimized-bucket-123456789 \ --key test.txt \ --restore-request '{"Days": 1, "GlacierJobParameters": {"Tier": "Standard"}}'
Check restore status:
Expected output (after ~3–5 hours):
{ "Restore": "ongoing-request=\"false\", expiry-date=\"2024-04-06T00:00:00.000Z\"", "StorageClass": "GLACIER" }
Download the restored file:
aws s3 cp s3://my-cost-optimized-bucket-123456789/test.txt ./restored_test.txt
bash aws s3api put-public-access-block \ --bucket my-bucket \ --public-access-block-configuration "BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true"
bash aws s3api put-bucket-versioning --bucket my-bucket --versioning-configuration Status=Enabled
bash aws s3control get-storage-lens-configuration --config-id default
bash aws s3api put-bucket-tagging --bucket my-bucket --tagging 'TagSet=[{Key=Environment,Value=Production}]'
company-project-environment-data
bash aws s3api put-bucket-logging --bucket my-bucket --bucket-logging-status file://logging.json
logging.json
Trap: Glacier Instant Retrieval is cheaper but has a 90-day minimum.
"You need the cheapest storage for compliance archives accessed once a year."
Trap: Glacier Flexible Retrieval is cheaper than Standard but not the cheapest.
"Which S3 class automatically moves data between tiers?"
Trap: Lifecycle policies manually move data—Intelligent-Tiering does it automatically.
"What’s the minimum storage duration for S3 Standard-IA?"
Challenge:You have a bucket with 100GB of logs. Some logs are accessed daily (last 7 days), some monthly (last 30 days), and the rest are never touched. Design a lifecycle policy to minimize costs.
Solution:
{ "Rules": [ { "ID": "MoveRecentLogsToIA", "Status": "Enabled", "Filter": { "Prefix": "logs/" }, "Transitions": [ { "Days": 7, "StorageClass": "STANDARD_IA" }, { "Days": 30, "StorageClass": "GLACIER" } ], "Expiration": { "Days": 365 } } ] }
Why it works:- First 7 days: Standard (frequent access).- Days 7–30: Standard-IA (cheaper, infrequent access).- After 30 days: Glacier (cold storage).- After 1 year: Expire (delete old logs).
aws s3api create-bucket
aws s3 cp --storage-class
--storage-class GLACIER
Transitions
Expiration
Final Tip:Always test lifecycle policies in a non-production bucket first. A misconfigured policy can accidentally delete data or incur unexpected fees. Use the AWS CLI to verify changes before applying them to production.
Join 4M+ learners. Unlock unlimited quizzes, wrong-answer tracking, flashcards + reminders, study guides, and 1-on-1 challenges.