EBS Snapshots, Encryption, and RAID
Create and automate EBS snapshots for point-in-time backups, encrypt volumes with KMS, and understand RAID 0 vs RAID 1 on EC2.
EBS Snapshots, Encryption, and RAID is a free AWS Solutions Architect lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the AWS Solutions Architect learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
EBS Snapshots: Point-in-Time Backups
EBS snapshots are point-in-time backups of EBS volumes stored durably in Amazon S3 (though managed by EBS, not directly accessible via the S3 console). The first snapshot is a full copy; subsequent snapshots are incremental — only the blocks that changed since the last snapshot are stored. Despite incremental storage, you can restore any single snapshot to a full volume. Snapshots are the primary mechanism for EBS volume backup, migration, and disaster recovery.
# Create a snapshot of an EBS volume with a description
aws ec2 create-snapshot \
--volume-id vol-0abc1234def567890 \
--description 'Production DB backup 2024-01-01' \
--tag-specifications 'ResourceType=snapshot,Tags=[{Key=Environment,Value=Production},{Key=Backup,Value=Daily}]'
# Monitor snapshot completion
aws ec2 describe-snapshots \
--snapshot-ids snap-0abc1234def567890 \
--query 'Snapshots[].{State:State,Progress:Progress}'Snapshot Costs and Lifecycle
You are billed for the actual storage consumed by incremental snapshot blocks across all snapshots of a volume — not for the volume size. If you delete intermediate snapshots, S3 consolidates the data so remaining snapshots still represent complete restore points. To manage costs at scale, use Amazon Data Lifecycle Manager (DLM) to create snapshot schedules and retention policies — for example, take daily snapshots, retain the last 7 daily + 4 weekly + 12 monthly, and delete older ones automatically.
# Create a DLM lifecycle policy for daily snapshots with 7-day retention
aws dlm create-lifecycle-policy \
--description 'Daily DB snapshots' \
--state ENABLED \
--execution-role-arn arn:aws:iam::111122223333:role/AWSDataLifecycleManagerDefaultRole \
--policy-details '{
"PolicyType": "EBS_SNAPSHOT_MANAGEMENT",
"ResourceTypes": ["VOLUME"],
"TargetTags": [{"Key": "Backup", "Value": "Daily"}],
"Schedules": [{
"Name": "DailySnapshots",
"CreateRule": {"Interval": 24, "IntervalUnit": "HOURS", "Times": ["03:00"]},
"RetainRule": {"Count": 7}
}]
}'Cross-Region and Cross-Account Snapshot Copies
Snapshots can be copied across Regions for disaster recovery and geographic distribution. You can also share snapshots with specific AWS accounts (or make them public) to transfer EBS data across accounts without using the network. When copying a snapshot, you can change the encryption key — this is how you move data from an unencrypted volume to an encrypted one, or from a key in one account to a key in another.
# Copy a snapshot to another region with a new KMS key
aws ec2 copy-snapshot \
--source-region us-east-1 \
--source-snapshot-id snap-0abc1234def567890 \
--destination-region eu-west-1 \
--description 'DR copy' \
--encrypted \
--kms-key-id arn:aws:kms:eu-west-1:111122223333:key/KEY_ID \
--region eu-west-1
# Share a snapshot with another account
aws ec2 modify-snapshot-attribute \
--snapshot-id snap-0abc1234def567890 \
--attribute createVolumePermission \
--operation-type add \
--user-ids '999888777666'Restoring Volumes from Snapshots
Creating a volume from a snapshot is straightforward, but there is a performance consideration: volumes restored from snapshots start with all blocks stored in S3 and are lazily loaded on first access. This can cause higher latency for blocks not yet loaded into the volume. For production databases, use Fast Snapshot Restore (FSR) — a paid feature that pre-warms the snapshot so volumes are immediately at full performance. Alternatively, pre-warm by reading all blocks with dd or fio after restore.
# Enable Fast Snapshot Restore for instant full-performance volumes
aws ec2 enable-fast-snapshot-restores \
--availability-zones us-east-1a us-east-1b \
--source-snapshot-ids snap-0abc1234def567890
# Create a volume from the snapshot (FSR enabled = full performance immediately)
aws ec2 create-volume \
--snapshot-id snap-0abc1234def567890 \
--volume-type gp3 \
--availability-zone us-east-1aEBS Encryption: How It Works
EBS encryption uses AES-256 to encrypt data at rest (on the volume), in transit between the volume and the EC2 instance, and in snapshots. Encryption is handled transparently by the EC2 hypervisor — your application does not see any difference. Encryption uses AWS KMS keys: you can use the AWS-managed key (aws/ebs) or a customer-managed key (CMK). Once a volume is encrypted, all data written to it and all snapshots taken from it are also encrypted.
# Create an encrypted gp3 volume with a customer-managed key
aws ec2 create-volume \
--volume-type gp3 \
--size 100 \
--encrypted \
--kms-key-id arn:aws:kms:us-east-1:111122223333:key/KEY_ID \
--availability-zone us-east-1a
# Enable encryption by default for all new volumes in a region
aws ec2 enable-ebs-encryption-by-default
aws ec2 get-ebs-encryption-by-default
# { "EbsEncryptionByDefault": true }Encrypting an Existing Unencrypted Volume
You cannot directly encrypt an existing unencrypted EBS volume. The workaround is a multi-step process: (1) create a snapshot of the unencrypted volume, (2) copy the snapshot with --encrypted to create an encrypted snapshot, (3) create a new encrypted volume from the encrypted snapshot, (4) stop the instance, detach the old volume, attach the new encrypted volume, and restart. This process can be scripted and is tested in the SAA-C03 exam as a migration scenario.
# Step-by-step: encrypt an existing unencrypted volume
# 1. Snapshot the unencrypted volume
aws ec2 create-snapshot --volume-id vol-UNENCRYPTED --description 'Pre-encryption backup'
# 2. Copy snapshot with encryption
aws ec2 copy-snapshot \
--source-region us-east-1 \
--source-snapshot-id snap-UNENCRYPTED \
--region us-east-1 \
--encrypted \
--kms-key-id alias/aws/ebs
# 3. Create encrypted volume from the encrypted snapshot
aws ec2 create-volume \
--snapshot-id snap-ENCRYPTED \
--volume-type gp3 \
--availability-zone us-east-1aRAID 0: Performance Striping
RAID 0 (striping) distributes data across multiple EBS volumes to aggregate their IOPS and throughput. Two 16,000 IOPS gp3 volumes in RAID 0 provide approximately 32,000 IOPS. The trade-off is that if either volume fails, you lose all data — there is no redundancy. RAID 0 is appropriate for temporary or easily re-created data where maximum throughput is the priority: cache layers, processing queues, or scratch space. EBS snapshots of the entire RAID array require consistency coordination.
# Set up RAID 0 across two EBS volumes on Linux
# (After creating and attaching two gp3 volumes)
# Install mdadm
sudo yum install -y mdadm
# Create a RAID 0 array across /dev/xvdf and /dev/xvdg
sudo mdadm --create /dev/md0 \
--level=0 \
--raid-devices=2 \
/dev/xvdf /dev/xvdg
# Format and mount
sudo mkfs.xfs /dev/md0
sudo mkdir /mnt/raid0
sudo mount /dev/md0 /mnt/raid0RAID 1: Mirroring for Redundancy
RAID 1 (mirroring) writes identical data to two EBS volumes simultaneously. If one volume fails, the other contains a complete copy. RAID 1 provides the redundancy of two volumes with only the capacity of one. However, for EBS volumes this is generally redundant with EBS's built-in AZ-level replication. AWS recommends using EBS Multi-AZ architectures (via Multi-AZ RDS or ASG across AZs) rather than RAID 1 on EBS, since EBS already replicates within an AZ. RAID 1 on EBS is rare in modern architectures.
# RAID 1 example (mirroring) — rarely needed with EBS
sudo mdadm --create /dev/md1 \
--level=1 \
--raid-devices=2 \
/dev/xvdh /dev/xvdi
# RAID 1 performance:
# Read: up to 2x (both disks can serve reads)
# Write: same as a single volume (data written to both)
# Fault tolerance: survives single volume failureAMIs and EBS Snapshots
An Amazon Machine Image (AMI) is a blueprint for launching EC2 instances, and it is backed by one or more EBS snapshots — one snapshot per volume the AMI includes (typically one for the root volume). When you create a custom AMI from a running instance, AWS stops (or uses VSS on Windows), takes snapshots of all attached EBS volumes, and records the mapping in the AMI. Deregistering an AMI does not automatically delete its backing snapshots — you must delete the snapshots separately to stop paying for them.
# Create an AMI from a running EC2 instance
aws ec2 create-image \
--instance-id i-0abc1234def567890 \
--name 'MyApp-v2.0-2024-01-01' \
--description 'Application server AMI with v2.0 release' \
--no-reboot
# List snapshots backing an AMI
aws ec2 describe-images \
--image-ids ami-0abc1234def567890 \
--query 'Images[].BlockDeviceMappings[].Ebs.SnapshotId'
# Deregister AMI then delete its snapshots separately
aws ec2 deregister-image --image-id ami-0abc1234def567890
aws ec2 delete-snapshot --snapshot-id snap-0abc1234def567890Snapshot Best Practices
Snapshot best practices for production workloads: freeze or quiesce the file system before snapshotting databases to ensure consistency (most managed databases like RDS do this automatically). Tag snapshots with environment, volume ID, and date to make lifecycle management and cost allocation easy. Test restore procedures regularly — a snapshot you have never restored is not a backup. Store cross-region copies for disaster recovery. Use AWS Backup for centralised policy management across EBS, RDS, DynamoDB, and other services.
# Freeze filesystem on Linux before snapshotting
# (Example for ext4 filesystem)
sudo fsfreeze -f /mnt/data # Freeze writes
aws ec2 create-snapshot --volume-id vol-0abc1234 --description 'Consistent snapshot'
sudo fsfreeze -u /mnt/data # Unfreeze
# AWS Backup policy for EBS volumes
aws backup create-backup-plan \
--backup-plan '{
"BackupPlanName": "EBSDaily",
"Rules": [{
"RuleName": "DailyRule",
"TargetBackupVaultName": "Default",
"ScheduleExpression": "cron(0 3 * * ? *)",
"DeleteAfterDays": 30
}]
}'EBS Snapshot Recycle Bin
The EBS Snapshot Recycle Bin protects against accidental deletion of snapshots and AMIs. When enabled with a retention rule, deleted snapshots are moved to the Recycle Bin instead of being permanently destroyed. You can recover them during the retention period (1 day to 1 year). This is particularly important for compliance scenarios where you must be able to recover from accidental deletion by an administrator or a runaway automation script without restoring from an older backup tier.
# Create a Recycle Bin retention rule for EBS snapshots
aws rbin create-rule \
--retention-period RetentionPeriodValue=30,RetentionPeriodUnit=DAYS \
--resource-type EBS_SNAPSHOT \
--description '30-day retention for all EBS snapshots'
# List snapshots currently in the Recycle Bin
aws rbin list-resources \
--resource-type EBS_SNAPSHOT \
--query 'Resources[].{SnapshotId:ResourceId,DeleteDate:DeleteScheduledAt}'Quick Check
Test your understanding of AWS Solutions Architect (SAA-C03) concepts from this lesson.
Lesson Recap
In this lesson you learned: EBS snapshots are incremental and stored in S3, with DLM for automated lifecycle management, encryption requires a snapshot copy workflow to convert unencrypted volumes, and RAID 0 stripes volumes for aggregated performance while RAID 1 mirrors for redundancy (though EBS already replicates within an AZ). Next up we explore EFS for shared Linux file storage.
Frequently asked questions
Is the “EBS Snapshots, Encryption, and RAID” lesson free?
Yes — the full text of “EBS Snapshots, Encryption, and RAID” is free to read here on the web, and the AWS Solutions Architect course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the AWS Solutions Architect course, upgrade to CoddyKit PRO.
What will I learn in “EBS Snapshots, Encryption, and RAID”?
Create and automate EBS snapshots for point-in-time backups, encrypt volumes with KMS, and understand RAID 0 vs RAID 1 on EC2. You practise AWS Solutions Architect with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start AWS Solutions Architect?
No prior experience is required. AWS Solutions Architect on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “EBS Snapshots, Encryption, and RAID” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this AWS Solutions Architect lesson?
Yes. Every AWS Solutions Architect lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- EBS Volume Types: gp3, io2, st1, sc1
- EBS Snapshots, Encryption, and RAID
- EFS: Shared File Storage for Linux
- FSx: Windows File Server and Lustre