Skip to main content
S3 Storage Classes

Module Overview

Estimated Time: 5-6 hours | Difficulty: Intermediate | Prerequisites: Core Concepts, Compute
This module covers all AWS storage and database services. You’ll learn data modeling, performance optimization, cost management, and when to use each service. What You’ll Learn:
  • S3 storage classes, lifecycle policies, and security
  • EBS volumes and snapshots for EC2
  • EFS for shared file systems
  • RDS and Aurora for relational databases
  • DynamoDB for NoSQL at scale
  • ElastiCache for sub-millisecond response times
  • Data migration strategies

Storage Service Selection Guide


Storage Types Comparison


S3 (Simple Storage Service)

Object storage with unlimited capacity. The backbone of AWS storage and data lakes. S3 is deceptively simple on the surface — just PUT and GET objects. But underneath it powers some of the largest data platforms in the world and has more configuration knobs than almost any other AWS service. The biggest cost mistake teams make with S3 is not setting up lifecycle policies — storing 5 years of logs in S3 Standard instead of Glacier Deep Archive can cost 20x more than necessary.

S3 Architecture Deep Dive

S3 Storage Classes Deep Dive

S3 Lifecycle Policies

S3 Security Best Practices

S3 Performance Optimization

Presigned URLs for Secure Sharing


EBS (Elastic Block Store)

Persistent block storage for EC2 instances. Like a high-performance SSD/HDD attached to your server. The key mental model: EBS volumes are network-attached storage that happens to be very fast. They persist independently of the EC2 instance (unlike instance store, which is physically attached and lost on stop/terminate). This means you can snapshot, detach, and reattach volumes — but it also means there is a small network latency penalty compared to local NVMe drives.

EBS Volume Types Deep Dive

EBS Snapshots and Backup

EBS Encryption

EBS is AZ-specific! Volumes only exist in one AZ. To move across AZs or regions:
  1. Create snapshot
  2. Copy to target region (if cross-region)
  3. Create volume in target AZ from snapshot

EFS (Elastic File System)

Managed NFS file system that scales automatically. Shared storage for Linux workloads. EFS solves the problem of “I need multiple EC2 instances (or Lambda functions, or containers) to read and write the same files.” Think of it as a shared network drive that auto-scales from kilobytes to petabytes. The trade-off is cost: EFS Standard at $0.30/GB is roughly 4x more expensive than EBS gp3, so only use it when you genuinely need shared access.

EFS vs EBS vs S3


RDS (Relational Database Service)

Managed relational databases: MySQL, PostgreSQL, MariaDB, Oracle, SQL Server, Aurora. RDS handles the undifferentiated heavy lifting of database administration — patching, backups, failover, replication — so your team can focus on schema design and query optimization. The most common mistake is treating RDS like a self-managed database: teams that manually manage backups or avoid Multi-AZ to save money end up paying much more in downtime and engineering hours when things go wrong.

RDS Architecture and Features

Multi-AZ vs Read Replicas

RDS Backup and Recovery


Aurora

AWS’s cloud-native relational database. MySQL and PostgreSQL compatible with 5x better performance.

Aurora Architecture Deep Dive

Aurora Serverless v2


DynamoDB

Fully managed NoSQL database with single-digit millisecond latency at any scale.

DynamoDB Data Model

DynamoDB Operations (Best Practices)

Global Secondary Indexes (GSI)

DynamoDB Capacity and Pricing


ElastiCache

Managed in-memory caching for sub-millisecond response times: Redis or Memcached.

ElastiCache Architecture

Redis vs Memcached Comparison

Caching Strategies


🎯 Interview Questions

S3 (Object Storage):
  • Static files, backups, data lakes
  • HTTP access from anywhere
  • Unlimited storage, 11 9s durability
EBS (Block Storage):
  • EC2 boot volumes, databases
  • Single EC2, single AZ
  • Low latency (sub-ms), resizable
EFS (File Storage):
  • Shared file systems across EC2
  • Multi-AZ, POSIX compliant
  • Auto-scaling, Linux only
Decision Matrix:
  • Need HTTP access globally → S3
  • Need database storage → EBS
  • Need shared NFS mount → EFS
Access Patterns:
  1. Get user profile
  2. Get user’s posts (sorted by date)
  3. Get post’s comments
  4. Get user’s followers
  5. Get posts by hashtag
Single Table Design:
Key Points:
  • Denormalize for read performance
  • Use composite sort keys
  • Create GSIs for access patterns
  • Use sparse indexes where appropriate
Multi-AZ (High Availability):
  • Purpose: Disaster recovery
  • Synchronous replication
  • Automatic failover (60-120s)
  • Standby NOT readable
  • Same region only
Read Replicas (Read Scaling):
  • Purpose: Performance/offload reads
  • Asynchronous replication
  • Manual promotion (becomes primary)
  • Replicas ARE readable
  • Can be cross-region
Best Practice: Use BOTH
  • Multi-AZ for production HA
  • Read replicas for read scaling
Strategies:
  1. TTL-Based (Simplest)
    • Set expiration on cache entries
    • Accept eventual consistency
  2. Event-Driven
    • Publish events on data changes
    • Consumers invalidate cache
  3. Write-Through
    • Update cache on every write
    • Never stale, but slower writes
  4. Cache-Aside with Versioning
    • Include version in cache key
    • Bump version on update
Code Pattern:
Strategy: Tiered Storage with Lifecycle
  1. Hot Data (Recent 30 days): S3 Standard
  2. Warm Data (30-90 days): S3 Standard-IA
  3. Cold Data (90+ days): S3 Glacier
  4. Archive (1+ year): S3 Glacier Deep Archive
Lifecycle Policy:
Cost Estimate (100 TB, us-east-1):
  • All Standard: $2,300/month
  • With lifecycle: ~$200/month (91% savings!)

🧪 Hands-On Lab: Build a Caching Layer

Objective: Add Redis caching to reduce database load by 80%
1

Create ElastiCache Redis Cluster

Use t3.micro for testing, enable encryption in transit
2

Modify Security Groups

Allow port 6379 from application servers
3

Implement Cache-Aside Pattern

Add caching layer to your application
4

Add TTL and Invalidation

Set appropriate TTLs, invalidate on writes
5

Monitor with CloudWatch

Track cache hit ratio, memory usage

Storage Comparison Summary


Next Module

Networking

Master VPC, subnets, security groups, and load balancers