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 & Real-World Production)
You’re a cloud engineer, and your team just migrated a monolithic app to AWS. The database is on an EBS volume, but performance is terrible—queries take 10x longer than on-prem. Meanwhile, your CFO is freaking out because storage costs are skyrocketing. EBS volume types and snapshots are your tools to fix this.
Real-world scenario:You inherit a legacy app with: - A gp2 volume for a high-traffic PostgreSQL DB (bottleneck: IOPS).- No automated snapshots (risk: data loss if the volume fails).- A st1 volume for logs (waste: logs don’t need high throughput).
This guide will show you:✅ How to diagnose which EBS type fits your workload.✅ How to migrate volumes without downtime.✅ How to automate snapshots (and avoid $10K/month in unused backups).✅ Exam traps (e.g., "Why is io2 better than gp3 for databases?").
aws ec2 copy-snapshot
✅ AWS CLI installed & configured (aws configure).✅ An EC2 instance with a gp2 volume (e.g., /dev/xvda).✅ Basic Linux knowledge (lsblk, df -h).
aws configure
/dev/xvda
lsblk
df -h
# List volumes attached to your instance aws ec2 describe-volumes --filters "Name=attachment.instance-id,Values=$(curl -s http://169.254.169.254/latest/meta-data/instance-id)" --query "Volumes[].{ID:VolumeId,Type:VolumeType,Size:Size,IOPS:Iops}" --output table
Expected Output:
----------------------------------------- | DescribeVolumes | +------------+-------+------+-----------+ | ID | Type | Size | IOPS | +------------+-------+------+-----------+ | vol-123456 | gp2 | 100 | 300 | +------------+-------+------+-----------+
Why this matters:- If IOPS is 300 (3 IOPS/GB for gp2), your DB might be throttled.- If Type is gp2, you’re overpaying.
IOPS
Type
aws ec2 create-snapshot --volume-id vol-123456 --description "Pre-migration backup" --tag-specifications 'ResourceType=snapshot,Tags=[{Key=Name,Value=gp2-to-gp3-migration}]'
Verify:
aws ec2 describe-snapshots --snapshot-ids $(aws ec2 describe-snapshots --filters "Name=tag:Name,Values=gp2-to-gp3-migration" --query "Snapshots[0].SnapshotId" --output text) --query "Snapshots[0].State"
Expected Output: "completed"
"completed"
aws ec2 create-volume \ --snapshot-id $(aws ec2 describe-snapshots --filters "Name=tag:Name,Values=gp2-to-gp3-migration" --query "Snapshots[0].SnapshotId" --output text) \ --volume-type gp3 \ --iops 3000 \ # Baseline for gp3 (can go up to 16,000) --throughput 125 \ # Baseline for gp3 (can go up to 1,000 MiB/s) --availability-zone $(aws ec2 describe-instances --instance-ids $(curl -s http://169.254.169.254/latest/meta-data/instance-id) --query "Reservations[0].Instances[0].Placement.AvailabilityZone" --output text) \ --tag-specifications 'ResourceType=volume,Tags=[{Key=Name,Value=gp3-migrated-volume}]'
aws ec2 describe-volumes --volume-ids $(aws ec2 describe-volumes --filters "Name=tag:Name,Values=gp3-migrated-volume" --query "Volumes[0].VolumeId" --output text) --query "Volumes[0].{Type:VolumeType,IOPS:Iops,Throughput:Throughput}"
{ "Type": "gp3", "IOPS": 3000, "Throughput": 125 }
# Detach old volume aws ec2 detach-volume --volume-id vol-123456 # Attach new volume (replace /dev/xvda with your device name) aws ec2 attach-volume --volume-id $(aws ec2 describe-volumes --filters "Name=tag:Name,Values=gp3-migrated-volume" --query "Volumes[0].VolumeId" --output text) --instance-id $(curl -s http://169.254.169.254/latest/meta-data/instance-id) --device /dev/xvda
On the EC2 instance:
# Check if the new volume is attached lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT xvda 202:0 0 100G 0 disk └─xvda1 202:1 0 100G 0 part /
# Install fio (Flexible I/O tester) sudo yum install -y fio # Run a quick benchmark (4K random reads) sudo fio --name=randread --ioengine=libaio --iodepth=16 --rw=randread --bs=4k --direct=1 --size=1G --numjobs=4 --runtime=60 --group_reporting
Expected Output (gp3 vs. gp2):| Metric | gp2 (300 IOPS) | gp3 (3,000 IOPS) | |--------------|----------------|------------------| | IOPS | ~300 | ~3,000 | | Latency | ~10ms | ~1ms |
# Delete the old gp2 volume (if you're sure the new one works) aws ec2 delete-volume --volume-id vol-123456
bash aws ec2 create-volume --encrypted --kms-key-id alias/aws/ebs ...
bash aws ec2 modify-snapshot-attribute --snapshot-id snap-123456 --attribute createVolumePermission --operation-type add --user-ids 123456789012
bash aws ec2 enable-ebs-encryption-by-default
bash # Find snapshots older than 30 days aws ec2 describe-snapshots --owner-ids self --query "Snapshots[?StartTime<='$(date -d "30 days ago" -u +"%Y-%m-%d")'].SnapshotId" --output text
Environment=prod
Backup=true
bash aws ec2 create-tags --resources vol-123456 --tags Key=Environment,Value=prod
bash aws dlm create-lifecycle-policy \ --description "Daily snapshots for prod volumes" \ --state ENABLED \ --execution-role-arn arn:aws:iam::123456789012:role/AWSDataLifecycleManagerDefaultRole \ --policy-details '{ "ResourceTypes": ["VOLUME"], "TargetTags": [{"Key": "Backup", "Value": "true"}], "Schedules": [{ "Name": "DailySnapshots", "CreateRule": {"Interval": 24, "IntervalUnit": "HOURS"}, "RetainRule": {"Count": 7}, "CopyTags": true }] }'
VolumeReadOps
VolumeWriteOps
VolumeQueueLength
BurstBalance
bash aws cloudwatch put-metric-alarm \ --alarm-name "EBS-High-Queue-Length" \ --metric-name VolumeQueueLength \ --namespace AWS/EBS \ --statistic Average \ --period 300 \ --threshold 1 \ --comparison-operator GreaterThanThreshold \ --evaluation-periods 2 \ --alarm-actions arn:aws:sns:us-east-1:123456789012:Alerts
BurstBalance < 20%
❌ gp3 (good for most workloads, but not high-performance DBs).
"You need a cost-effective volume for infrequently accessed logs. Which type?"
❌ sc1 (even cheaper, but too slow for logs).
"How do you migrate a gp2 volume to gp3 without downtime?"
❌ "Just change the volume type in the console" (not possible).
"What happens if you delete an EBS volume with snapshots?"
Scenario:You have a gp2 volume (vol-123456) attached to an EC2 instance. Your DB is slow, and you suspect IOPS throttling. Migrate it to gp3 with 5,000 IOPS and verify performance improvement.
vol-123456
Solution:
# 1. Create snapshot aws ec2 create-snapshot --volume-id vol-123456 --description "Migration to gp3" # 2. Create gp3 volume from snapshot (5,000 IOPS) aws ec2 create-volume --snapshot-id snap-123456 --volume-type gp3 --iops 5000 --availability-zone us-east-1a # 3. Detach old volume, attach new one aws ec2 detach-volume --volume-id vol-123456 aws ec2 attach-volume --volume-id vol-789012 --instance-id i-1234567890 --device /dev/xvda # 4. Verify with fio sudo fio --name=randread --ioengine=libaio --iodepth=16 --rw=randread --bs=4k --direct=1 --size=1G --numjobs=4 --runtime=60 --group_reporting
Why it works:- gp3 provides baseline 3,000 IOPS (scalable to 16,000).- Incremental snapshots mean no data loss.- Zero downtime (detach/attach takes seconds).
aws ec2 create-volume --volume-type gp3 --iops 3000 --size 100
aws ec2 create-snapshot --volume-id vol-123456
aws ec2 copy-snapshot --source-region us-east-1 --source-snapshot-id snap-123456 --destination-region us-west-2
aws ec2 create-volume --snapshot-id snap-123456 --availability-zone us-east-1a
aws ec2 enable-ebs-encryption-by-default
Join 4M+ learners. Unlock unlimited quizzes, wrong-answer tracking, flashcards + reminders, study guides, and 1-on-1 challenges.