EBS encryption in AWS
Amazon EBS encryption provides transparent, at‑rest encryption for EBS volumes, their snapshots, and any volumes created from those snapshots. It integrates with AWS KMS for key management, uses AES‑256 with hardware acceleration on Nitro instances, and requires no application changes.
How EBS Encryption works
- Envelope encryption with KMS: a unique data key encrypts each volume; that data key is protected (encrypted) by a KMS key (AWS managed alias/aws/ebs or your customer managed key). This enables secure key storage, auditing, and policy control.
- Scope and inheritance: if a volume is encrypted, every snapshot from it is encrypted; every volume restored from those snapshots is encrypted. Encryption status “follows” the lineage.
- Data in transit: I/O between EC2 and encrypted EBS volumes is protected by the service. On Nitro‑based instances, this is hardware‑accelerated and near zero‑overhead.
What gets encrypted
- Root and data EBS volumes, including boot volumes.
- All snapshots of encrypted volumes and all volumes created from those snapshots.
- AMIs that use EBS volumes are backed by snapshots; when those snapshots are encrypted, the AMI effectively carries encryption.
Default encryption (must‑know)
- You can enable EBS default encryption per region so all newly created volumes and snapshots are encrypted automatically, even when you launch from an unencrypted AMI or snapshot.
- You can choose the default KMS key: either the AWS managed key alias/aws/ebs or a customer managed KMS key.
- Enabling default encryption does not retroactively encrypt existing volumes or snapshots.
CLI quick reference:
aws ec2 enable-ebs-encryption-by-default
aws ec2 modify-ebs-default-kms-key-id--kms-key-idalias/my-ebs-key
aws ec2 get-ebs-encryption-by-default
aws ec2 get-ebs-default-kms-key-id
Encrypting existing unencrypted data (typical exam scenario)
- There is no in‑place toggle to encrypt an unencrypted EBS volume. The supported pattern is: create a snapshot → copy the snapshot with --encrypted and a KMS key → create a new volume from the encrypted copy → cut over by attaching the new volume.
- You cannot decrypt an encrypted snapshot or volume. You can only re‑encrypt to a different KMS key by copying.
CLI quick reference:
# Make an encrypted copy of an unencrypted snapshot (optionally to another region)
aws ec2 copy-snapshot \
--source-regionus-east-1 \
--source-snapshot-id snap-0123... \
--encrypted \
--kms-key-id arn:aws:kms:us-east-1:111122223333:key/abcd-...
# Create volume from the encrypted snapshot
aws ec2 create-volume --availability-zone us-east-1a --snapshot-id snap-0enc... --volume-type gp3
Snapshots, AMIs, and sharing
- AMIs consist of one or more EBS snapshots and metadata. If those snapshots are encrypted, the AMI is considered encrypted.
- Cross‑account use of encrypted snapshots/AMIs requires two shares: share the snapshot/AMI and allow the target account to use the KMS key (via key policy or a grant). Without KMS permissions, the recipient cannot create volumes.
- Cross‑region copies require selecting a KMS key in the destination region. Multi‑Region KMS keys can simplify key management but you still pick a regional key replica for the copy.
- When your account has default encryption enabled, launching from an unencrypted AMI will still result in encrypted volumes at launch time; the original AMI remains unencrypted.
KMS keys and policies (Security‑Specialty depth that appears in Associates/Pros too)
- Key choices: AWS managed key (minimal management) or customer managed key (fine‑grained IAM policies, grants, rotation, and cross‑account access).
- Useful policy conditions: kms:ViaService can restrict key usage to the EC2 service in specific regions; this limits misuse.
- Rotation: enabling automatic annual rotation on customer managed keys does not re‑encrypt existing data; EBS continues to work because data keys remain valid.
- Disabling or deleting a KMS key breaks workflows: creating, attaching, or restoring volumes that rely on that key fails. Deleting a key ultimately renders encrypted data unrecoverable.
Performance, cost, and compatibility
- Performance: on Nitro‑based instances, encryption overhead is negligible due to hardware acceleration. Most current instance families support EBS encryption.
- Cost: there is no extra charge for turning on EBS encryption itself. Standard EBS storage and snapshot costs apply, and KMS API usage is billed per request.
- Features: all EBS volume types (gp3, io2, st1, sc1) support encryption, including Multi‑Attach for io1/io2.
Compliance and operations
- Audit: use AWS Config managed rules such as encrypted-volumes and ebs-encryption-by-default to detect noncompliance. CloudTrail logs KMS usage.
- DR: copy encrypted snapshots to another region with a key in that region, periodically test restores, and consider Fast Snapshot Restore (FSR) for immediate full‑speed access after restore.
- Tagging and governance: tag volumes and snapshots with sensitivity and owner; enforce encryption policies via IAM/SCPs and Service Control Policies in AWS Organizations.
Common exam scenarios and answers
- “How do you encrypt an existing unencrypted volume?” You cannot encrypt in place. Take a snapshot, copy it with encryption, create a new encrypted volume, and swap.
- “Can you decrypt an encrypted snapshot?” No. You can only re‑encrypt to another KMS key by copying.
- “How to share an encrypted AMI with another account?” Share the AMI and its snapshots and grant the target account permissions on the KMS key used to encrypt them.
- “What happens if default encryption is enabled and I launch from an unencrypted AMI?” The launched volumes are encrypted in your account with the default key; the source AMI remains unencrypted.
- “What if the KMS key is disabled?” Operations that need the key (creating, attaching, restoring) will fail; data can become unusable if the key is deleted.
- “Is data between EC2 and EBS protected?” Yes; encrypted volumes are transparently protected, with hardware acceleration on Nitro.
