S3 Lifecycle Rules: Transitions and Expirations
S3 Lifecycle Rules automate moving objects between storage classes and deleting expired objects. Configure rules at bucket or prefix/suffix level.
Transition actions move objects to different storage classes after specified days. Common patterns: Standard → Standard-IA after 30 days → Glacier Flexible after 90 days → Glacier Deep Archive after 365 days. Transition rules require versioning to be enabled.
Expiration actions permanently delete objects after a period. Delete current versions, non-current versions, expired object delete markers, and incomplete multipart uploads. Use expiration for temporary data, log rotation, and compliance-driven retention.
Rule configuration: specify prefix (e.g., logs/), transition days, expiration days, and non-current version handling. Rules can have multiple transitions—objects move through the lifecycle chain. Monitor with CloudWatch BucketSizeBytes per storage class.
S3 Intelligent-Tiering for Automatic Cost Optimization
S3 Intelligent-Tiering automatically moves objects between four access tiers based on usage—no retrieval fees. Objects start in Frequent Access tier, move to Infrequent Access after 30 days, Archive Instant Access after 90 days, and Deep Archive Access after 180 days.
If an object in a lower tier is accessed, it moves back to Frequent Access immediately. Small monitoring fee per object ($0.0025 per 1,000 objects) but no retrieval fees—saves 30-70% for unknown or variable access patterns.
Deep Archive Access tier is not default—opt in for objects you expect to archive long-term. Archive Access tier is similar to Glacier Instant Retrieval. Both have retrieval fees when accessed.
Best for: data lakes with unknown access patterns, user-generated content, log data with unpredictable analysis schedules. Combine with lifecycle rules for expiration actions—Intelligent-Tiering handles tiering, lifecycle handles deletion.
EBS Snapshots Lifecycle Management
EBS Snapshot Lifecycle Policies automate backup management through AWS Backup or Data Lifecycle Manager. Define retention schedules—keep daily snapshots for 7 days, weekly for 4 weeks, monthly for 12 months.
AWS Backup provides centralized backup across EBS, EFS, RDS, DynamoDB, and Storage Gateway. Create backup plans with schedules, retention, and copy rules. Cross-region copy for DR. Restore to new volumes with specified type and encryption.
Data Lifecycle Manager automates EBS snapshot and AMI lifecycle. Create policies targeting volumes by tags. Set retention counts or dates. Automatically copy snapshots to another region for DR. Create golden AMIs for standardized deployments.
Snapshot age management: delete old snapshots manually or through policies. Snapshots of deleted volumes persist—set up cleanup automation. Use tags to identify snapshot purpose (daily, weekly, compliance).
EFS Infrequent Access and Cost Optimization
EFS Infrequent Access (IA) stores infrequently accessed files at 60% lower cost. Files are accessed on-demand when read—first access incurs a per-GB retrieval charge. Configure lifecycle policies to transition files after 7, 14, 30, 60, or 90 days of inaccessibility.
How EFS IA works: files start in Standard storage. When lifecycle policy triggers, files not accessed within the period move to IA automatically. Reading an IA file instantly moves it back to Standard. No manual intervention required.
Monitor with CloudWatch: StorageBytesStandard and StorageBytesIA track usage in each tier. MeteredIABytes shows data read from IA. Use LifecycleTransitionTime to monitor policy execution.
Cost optimization strategy: combine EFS IA with access point restrictions. Different applications can have different lifecycle policies—production (30 days) vs archive (7 days). Monitor costs with Cost Explorer filtered by UsageType for EFS:IA.
Storage Cost Optimization Across Services
S3 cost optimization: use lifecycle rules to move data to cheaper tiers. Standard → IA (30%) savings, Glacier (60-80%), Deep Archive (90%). Intelligent-Tiering for unknown patterns. Delete incomplete multipart uploads after 7 days.
EBS cost optimization: migrate gp2 to gp3 (20% cheaper). Delete unused snapshots. Use lifecycle policies to automate snapshot retention. Right-size over-provisioned volumes.
EFS cost optimization: enable EFS IA lifecycle policies. Use One Zone for non-critical data. Monitor storage class distribution.
Cost allocation tags: tag storage resources by environment, project, and owner. Use Cost Explorer to identify spending patterns. Set up AWS Budgets with alerts for storage cost anomalies.
Rule of thumb: data accessed daily → Standard. Monthly → One Zone-IA or Standard-IA. Quarterly → Glacier Instant. Yearly → Glacier Flexible. Multi-year → Deep Archive.
Quiz
1. What is the main benefit of S3 Intelligent-Tiering?
2. How does EFS Infrequent Access work?
3. When should you use Glacier Deep Archive vs Glacier Flexible Retrieval?
Flashcards
Question
What are S3 Lifecycle Rules?
Click to reveal answer
Answer
Automation rules that transition objects between storage classes and expire (delete) objects after specified periods.
Question
What is S3 Intelligent-Tiering?
Click to reveal answer
Answer
A storage class that automatically moves objects between access tiers based on usage with no retrieval fees, saving 30-70%.
Question
What is EFS IA?
Click to reveal answer
Answer
EFS Infrequent Access stores files at 60% lower cost, automatically transitioning after a configured inactivity period.
Question
What is the recommended storage strategy for data accessed yearly?
Click to reveal answer
Answer
S3 Glacier Flexible Retrieval or Glacier Deep Archive, depending on acceptable retrieval time (minutes vs hours).
Revision Notes
Key Takeaways
- 1. S3 lifecycle rules automate tiering and expiration—plan Standard → IA → Glacier → Deep Archive chain
- 2. Intelligent-Tiering saves 30-70% for unknown access patterns with no retrieval fees
- 3. EFS IA auto-transitions files after inactivity period, first read moves back to Standard
- 4. Combine lifecycle policies with cost monitoring and tagging for governance
Interview Tips
- • Design a lifecycle strategy for specific data retention requirements
- • Explain the cost difference between Glacier Flexible and Deep Archive
- • Discuss how to handle compliance-driven retention with lifecycle rules
- • Compare lifecycle management across S3, EBS, and EFS
Cheat Sheet
S3 Lifecycle: transition rules (Standard→IA→Glacier→Deep Archive), expiration rules (delete old data). Intelligent-Tiering: auto tiering, no retrieval fees, 30-70% savings. EBS snapshots: lifecycle policies via AWS Backup/DLM, automate retention and cross-region copy. EFS IA: auto-transition after 7-90 days inactivity, 60% cheaper. Cost rule: daily=Standard, monthly=IA, quarterly=Glacier Instant, yearly=Glacier Flexible, multi-year=Deep Archive.