Asterrr's Handbook

Storage encryption

Encryption at rest for EBS, snapshots and AMIs, RDS and Aurora, DynamoDB and the AWS Database Encryption SDK, EFS and FSx, and what happens to each when its KMS key is disabled or deleted.

Exam tasks: 5.2.1 (choose KMS options and client- vs server-side encryption), 5.2.3 (lifecycle of data at rest)

The decision: can encryption be turned on in place or only at creation, which key does each copy (snapshot, replica, backup) use, and what breaks, and when, if that key becomes unusable?

Can you encrypt what already exists?

ServiceEncrypt an existing unencrypted resource in place?How to get there
EBS volumeNoSnapshot, then create an encrypted volume from it (or copy the snapshot with encryption)
RDS / AuroraNoSnapshot, copy the snapshot with a KMS key, restore a new encrypted instance or cluster
DynamoDBAlways encryptedSwitch between AWS owned, AWS managed and customer managed keys at any time
EFSNoCreate a new encrypted file system and copy data (DataSync or AWS Backup restore)
FSx (all types)Always encryptedChoose the KMS key at creation
S3New writes onlyChange default encryption; rewrite old objects with Batch Operations
SQS, SNSYesTurn on SSE-SQS or SSE-KMS; applies to new messages

Amazon EBS

  • Encryption by default is a per-account, per-Region setting. Once on, every new volume and snapshot copy is encrypted with the default key (aws/ebs unless you choose a customer managed key). Turn it on in every Region you use, detect gaps with the Config rule ec2-ebs-encryption-by-default, and back it with an SCP that denies ec2:CreateVolume when ec2:Encrypted is false.
  • Encryption covers data at rest, data moving between the instance and the volume, snapshots and volumes created from them. It happens in Nitro hardware with no performance cost.
  • A volume created from an encrypted snapshot is always encrypted. You can change the key when you copy a snapshot or create a volume from it.

Sharing snapshots and AMIs

Snapshot encrypted withCan share with another account?
UnencryptedYes, or even publicly (risky)
aws/ebs (AWS managed key)No, because you can't give another account access to that key
Customer managed keyYes: share the snapshot and allow the other account in the key policy
  • The receiving account should copy the shared snapshot with its own key, so it no longer depends on your key.
  • Encrypted snapshots can never be made public. Turn on block public access for EBS snapshots and for AMIs at account level to stop accidental public sharing of unencrypted ones.

Re-sharing with the default key

Copying a snapshot "to share it" while leaving the default aws/ebs key selected produces a snapshot that still can't be shared. The copy must use a customer managed key whose policy includes the target account.

Amazon RDS and Aurora

  • Encryption is chosen at creation and covers storage, automated backups, snapshots, read replicas and logs. You can't encrypt an existing unencrypted instance or change its key in place; use the snapshot-copy path.
  • Read replicas in the same Region use the same key. A cross-Region replica or snapshot copy needs a KMS key in the destination Region.
  • Sharing an encrypted snapshot works only with a customer managed key, exactly as for EBS.
  • TDE for Oracle and SQL Server is an extra, engine-level option. RDS TDE uses the RDS-managed wallet; to keep a TDE master key in your own HSM, run the database on EC2 with CloudHSM (see Key material and HSMs).

Amazon DynamoDB

  • Every table is encrypted at rest: tables, indexes, streams, backups and global table replicas.
  • Choose between AWS owned (default, no charge), AWS managed (aws/dynamodb) and customer managed. You can switch keys on an existing table without downtime.
  • Server-side encryption means anyone allowed dynamodb:GetItem sees plaintext. When specific attributes must stay unreadable even to people with table access, encrypt them on the client.

AWS Database Encryption SDK

  • Client-side library that encrypts and signs individual attributes before they reach DynamoDB. You choose per attribute: encrypt and sign, sign only, or leave alone.
  • Searchable encryption (beacons) lets you query encrypted attributes without decrypting the table.
  • Keys come from KMS through keyrings, including the hierarchical keyring that caches branch keys to reduce KMS calls. Use a multi-Region key when the table is a global table.

Legacy: use the AWS Database Encryption SDK instead

The DynamoDB Encryption Client is the predecessor. It is still supported for existing data, but new designs should use the Database Encryption SDK, which adds searchable encryption and signed item structure.

EFS and FSx

  • EFS: encryption at rest is set when you create the file system. Encryption in transit uses TLS through the EFS mount helper (-o tls). Enforce it with a file system policy that denies aws:SecureTransport false.
  • EFS lifecycle management moves files that aren't accessed to Infrequent Access and Archive, and back to Standard on first access. It changes cost, not encryption.
  • FSx (Windows File Server, Lustre, ONTAP, OpenZFS) always encrypts at rest with KMS. In transit: SMB 3 encryption for Windows and ONTAP SMB, Kerberos or TLS options for NFS, and Nitro-based encryption for Lustre clients on supported instances.
  • FSx for Lustre backups work only on persistent file systems that aren't linked to an S3 data repository. Scratch file systems can't be backed up.

When the key becomes unusable

KMS keys become unusable when disabled, scheduled for deletion, when imported material expires or is deleted, or when a custom key store disconnects. Services feel it at different times:

ServiceImmediate effectLater effectRecovery
EBSNone: the data key is already in the Nitro hardware of the attached instanceDetach, stop or reattach failsMake the key usable again, then attach
S3 SSE-KMSNew GETs and PUTs fail with AccessDenied / KMS errorsSameRe-enable the key
RDS / AuroraInstance moves to inaccessible-encryption-credentials-recoverable after about 2 hoursAfter 7 days it becomes terminal; only a restore from backup helpsRe-enable the key and start the instance within 7 days
DynamoDB (customer managed key)Table status becomes INACCESSIBLE_ENCRYPTION_CREDENTIALSAfter 7 days, DynamoDB archives the table and takes an on-demand backup; global table replicas drop out after about 20 hoursRestore key access within 7 days, or re-enable the key and restore from the archival backup
Deleted key (any service)PermanentPermanentNone. Ciphertext is gone

Exam signal

"The KMS key was accidentally disabled" is recoverable: re-enable it. "The key was scheduled for deletion" is recoverable within the waiting period: cancel deletion, then re-enable. "The imported key material was deleted" is recoverable by importing the same material. "The key was deleted" is not recoverable.

Scenarios

Scenario
An auditor finds that a production Amazon RDS for PostgreSQL instance was created without encryption. The company must encrypt it with a customer managed KMS key while keeping downtime as short as possible and without changing the database engine. What should the security engineer do?
Scenario
A logistics company wants to share EBS snapshots of an analytics server with its auditor's AWS account. The snapshots are encrypted with the default aws/ebs key. What must the company do so the auditor can create volumes from them?
Scenario
An employee disabled a customer managed KMS key that protects an EBS data volume on a running EC2 instance and an S3 bucket used by the same application. Users report that downloads from the bucket fail, but the instance still reads and writes its data volume. What explains the behaviour?

Further reading

On this page