EBS encryption
How EBS encryption with KMS works, encryption by default, and how to encrypt a volume that wasn't encrypted.
What it is
EBS can encrypt volumes and snapshots with keys from AWS KMS (Key Management Service), using AES-256. When an encrypted volume is created:
- data at rest inside the volume is encrypted;
- data in flight between the instance and the volume is encrypted;
- all snapshots of the volume are encrypted;
- all volumes created from those snapshots are encrypted.
Encryption and decryption happen transparently on the EC2 host: the operating system and applications don't change, and the effect on latency is minimal. Every instance type supports it, and it costs nothing extra (beyond KMS key use if a customer managed key is created; the AWS-managed aws/ebs key is free).
Encryption by default
EBS encryption by default can be turned on in the EC2 settings. Every new volume and snapshot copy in that Region is then encrypted automatically. It's a per-Region account setting and doesn't change volumes that already exist. Many companies turn it on in every Region on day one.
Encrypting an unencrypted volume
Encryption can't be switched on for an existing volume. Instead, copy the data through a snapshot:
- Create an EBS snapshot of the unencrypted volume.
- Copy the snapshot and tick encrypt, choosing a KMS key. The copy is encrypted.
- Create a new volume from the encrypted snapshot. It's encrypted too.
- Attach the encrypted volume to the original instance (swap it in place of the old one), then delete the old volume.
Shortcut: step 2 isn't strictly needed. An encrypted volume can be created directly from the unencrypted snapshot by turning on encryption at volume creation.
Two related rules:
- A snapshot of an encrypted volume is always encrypted; an unencrypted copy can't be made.
- The KMS key of an existing volume or snapshot can't be changed, but a snapshot copy can use a different key. That's also how a volume is re-keyed, or share encrypted snapshots with another account using a key it can use.
Exam tips
- "Encrypt an existing unencrypted EBS volume" → snapshot, copy (or restore) with encryption, create a new volume, swap it in.
- "Make sure all new EBS volumes are encrypted" → turn on EBS encryption by default in each Region (and enforce it with an SCP or AWS Config rule).
- What's encrypted with an encrypted volume: data at rest, data in transit to the instance, snapshots, and volumes made from those snapshots.
Common traps
- "Tick encrypt on the existing volume." Not possible; go through a snapshot.
- "Encryption needs changes in the application." It's transparent to the OS and apps.
- "Encryption by default encrypts my old volumes." Only new ones.
Hands-on lab: encrypt a volume through a snapshot
Goal: turn an unencrypted volume into an encrypted one.
Costs money
Two 10 GiB gp3 volumes and two small snapshots for under an hour: about a cent. The AWS-managed key aws/ebs is free.
Check the account setting
In the EC2 console, open Dashboard → Account attributes → Data protection and security. Note whether EBS encryption by default is on. If it is, the volume in the next step will already be encrypted; that's fine, just read along.
Create an unencrypted volume
Volumes → Create volume: gp3, 10 GiB, encryption off, tag Project=saa-lab. Its Encryption column says Not encrypted.
Snapshot and copy with encryption
Create a snapshot of it. When it's Completed, select it and Actions → Copy snapshot: tick Encrypt this snapshot, KMS key aws/ebs. The copy shows Encrypted.
Create the encrypted volume
From the encrypted copy, Actions → Create volume from snapshot in any AZ. The new volume is Encrypted, and its KMS key is aws/ebs.
Expected result: the same data in a volume that's now encrypted.
Clean up: delete both volumes and both snapshots.