(For AWS Solutions Architect – Associate & Real-World Deployments)
You’re a cloud engineer at a fintech startup. Your team just migrated a high-frequency trading app to AWS, but performance is abysmal. The database team blames "slow disks," the devs say "the app is fine," and your CTO is breathing down your neck. The root cause? The wrong storage type was chosen for the EC2 instances.
AWS offers three primary storage options for EC2: 1. Instance Store (ephemeral, ultra-fast, but volatile) 2. EBS (persistent, block storage, like a virtual hard drive) 3. EFS (shared, scalable, NFS-like file system)
Why this matters in production:- Performance: Instance Store can deliver 1.5M IOPS (vs. EBS’s 64K max). If you pick EBS for a high-I/O workload, your app will crawl.- Durability: Instance Store disappears when the instance stops. If you store critical data there, it’s gone forever.- Cost: EFS is 10x more expensive than EBS for the same capacity. If you use EFS for a single-instance app, you’re wasting money.- Scalability: EFS scales automatically to petabytes, while EBS maxes out at 64 TiB per volume. If your app grows, EBS may force a painful migration.
Real-world scenario:You inherit a legacy app running on a single EC2 instance with Instance Store. The instance reboots unexpectedly, and all data is lost. The business loses $50K in transactions. Your job is to prevent this.
i3en
io1/io2
aws --version
run-instances
attach-volume
# Launch an i3.large (has NVMe Instance Store) aws ec2 run-instances \ --image-id ami-0c55b159cbfafe1f0 \ # Amazon Linux 2 --instance-type i3.large \ --key-name your-key-pair \ --security-group-ids sg-12345678 \ --subnet-id subnet-12345678 \ --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=InstanceStoreDemo}]'
Verify Instance Store is attached:
# SSH into the instance ssh -i "your-key-pair.pem" ec2-user@<public-ip> # List block devices (should show /dev/nvme0n1) lsblk # Format and mount Instance Store (temporary!) sudo mkfs -t xfs /dev/nvme0n1 sudo mkdir /mnt/instance-store sudo mount /dev/nvme0n1 /mnt/instance-store
⚠️ Warning: Data here disappears when the instance stops.
# Create a 10GB gp3 EBS volume aws ec2 create-volume \ --availability-zone us-east-1a \ --size 10 \ --volume-type gp3 \ --tag-specifications 'ResourceType=volume,Tags=[{Key=Name,Value=EBSDemo}]' # Attach it to the instance aws ec2 attach-volume \ --volume-id vol-1234567890abcdef0 \ --instance-id i-1234567890abcdef0 \ --device /dev/sdf
Format and mount EBS:
# SSH into the instance ssh -i "your-key-pair.pem" ec2-user@<public-ip> # List block devices (should show /dev/nvme1n1) lsblk # Format and mount EBS (persistent!) sudo mkfs -t xfs /dev/nvme1n1 sudo mkdir /mnt/ebs sudo mount /dev/nvme1n1 /mnt/ebs
✅ Data here survives reboots.
# Create an EFS file system aws efs create-file-system \ --creation-token efs-demo \ --performance-mode generalPurpose \ --tags Key=Name,Value=EFSDemo # Note the FileSystemId (e.g., fs-12345678) aws efs describe-file-systems # Create a mount target in the same subnet as the instance aws efs create-mount-target \ --file-system-id fs-12345678 \ --subnet-id subnet-12345678 \ --security-groups sg-12345678
Mount EFS on the instance:
# SSH into the instance ssh -i "your-key-pair.pem" ec2-user@<public-ip> # Install NFS utils sudo yum install -y amazon-efs-utils # Create mount directory sudo mkdir /mnt/efs # Mount EFS (replace fs-12345678 with your FileSystemId) sudo mount -t efs fs-12345678:/ /mnt/efs
✅ Multiple instances can now access /mnt/efs simultaneously.
/mnt/efs
tls
PercentIOLimit
VolumeReadOps
VolumeWriteOps
BurstBalance
ClientConnections
PermittedThroughput
BurstCreditBalance
BurstBalance < 20%
BurstCreditBalance < 10%
Trap: EFS is not ideal for databases (high latency).
"You need shared storage for 10 EC2 instances. Which do you choose?"
Trap: EBS cannot be mounted to multiple instances (except io1/io2, but with limitations).
"A team accidentally deleted an EBS volume. How can they recover it?"
Trap: EBS volumes cannot be recovered after deletion (unlike S3).
"Which storage type is cheapest for temporary files?"
You’re running a Jenkins CI/CD server on EC2. The server stores: - Build artifacts (temporary, can be regenerated).- Configuration files (must persist across reboots).- Shared workspace (used by multiple Jenkins agents).
Which storage types should you use for each, and why?
Implementation:
# 1. Launch instance with Instance Store (for build artifacts) aws ec2 run-instances --instance-type i3.large ... # 2. Attach EBS (for config files) aws ec2 attach-volume --volume-id vol-12345678 ... # 3. Mount EFS (for shared workspace) sudo mount -t efs fs-12345678:/ /mnt/efs
/dev/nvme0n1
aws ec2 create-volume --volume-type gp3
sudo mount -t efs fs-12345678:/ /mnt/efs
generalPurpose
maxIO
Instance Store = Race car (fast, but crashes destroy everything).EBS = SUV (reliable, but only one driver at a time).EFS = Carpool lane (shared, but slower and expensive).
Pick the right one, or your app will break. ?
Join 4M+ learners. Unlock unlimited quizzes, wrong-answer tracking, flashcards + reminders, study guides, and 1-on-1 challenges.