Concept
Securing databases
Encrypt, authenticate and isolate RDS, Aurora, DynamoDB and ElastiCache.
- At rest
- KMS, set at creation
- Access control
- Security groups, IAM authentication
- In transit
- TLS, can be forced
- At rest
- Always on
- Access control
- IAM, fine-grained conditions
- In transit
- HTTPS
- At rest
- Optional, set at creation
- Access control
- AUTH token or RBAC
- In transit
- Optional TLS
| Database | At rest | Access control | In transit |
|---|---|---|---|
| KMS, set at creation | Security groups, IAM authentication | TLS, can be forced | |
| Always on | IAM, fine-grained conditions | HTTPS | |
| Optional, set at creation | AUTH token or RBAC | Optional TLS |
1 / 2
2 / 2
- At rest
- Optional, set at creation
- Access control
- AUTH token or RBAC
- In transit
- Optional TLS
| Database | At rest | Access control | In transit |
|---|---|---|---|
| Optional, set at creation | AUTH token or RBAC | Optional TLS |
- 1Take a snapshot of the unencrypted database.
- 2Copy the snapshot and turn on encryption with a KMS key.
- 3Restore the encrypted copy as a new database and switch the application to it.
Step by step
- 1Take a snapshot of the unencrypted database.
- 2Copy the snapshot and turn on encryption with a KMS key.
- 3Restore the encrypted copy as a new database and switch the application to it.
How to encrypt a database that already exists.
What it is
Amazon RDS and Amazon Aurora encrypt storage, backups, snapshots and read replicas with AWS KMS. You must turn this on when you create the database. You cannot encrypt an existing database in place. Take a snapshot, copy it with encryption on, and restore the copy. IAM database authentication replaces the password with a token that is valid for 15 minutes. It works with MariaDB, MySQL, PostgreSQL and Aurora (MySQL and PostgreSQL editions), and needs TLS. Force TLS with a database parameter. AWS Secrets Manager can rotate the passwords that remain.
What it is
Amazon DynamoDB always encrypts data at rest, with an AWS owned key by default, or an AWS managed or customer managed KMS key if you want audit and control. Traffic uses HTTPS. IAM policy conditions give fine-grained access, down to the items and attributes a user may read. A gateway endpoint keeps access private.
Amazon ElastiCache can encrypt data at rest and in transit. At-rest encryption is chosen when you create the cluster. In-transit encryption can also be chosen at creation, and on newer Valkey and Redis OSS versions you can turn it on later. For Valkey and Redis, an AUTH token or role-based access control limits who connects.
What it is
For every database, use the network too. Place it in a private or isolated subnet, turn off public access, and allow the database port only from the application’s security group.
Remember
- RDS and Aurora encryption: chosen at creation. Encrypt an existing database through a snapshot copy.
- IAM database authentication: 15-minute tokens, MariaDB, MySQL, PostgreSQL and Aurora, with TLS.
- DynamoDB: encrypted at rest always. IAM conditions give item and attribute level control.
Remember
- ElastiCache: at-rest encryption chosen at creation. In-transit at creation, or later on newer versions. AUTH or RBAC for users.
- Database security group: allow the port from the app security group only.
- Secrets Manager rotates the database password.
On the exam
- “Encrypt an existing unencrypted RDS database” points to snapshot, encrypted copy, then restore.
- “Application connects to the database with no stored password” points to IAM database authentication.
- “Users may read only their own DynamoDB items” points to IAM fine-grained access with a leading-keys condition.
Do not mix it up with
AWS Secrets ManagerRotate and share secrets across accounts and Regions, and choose it or Parameter Store.
AWS Key Management Service (AWS KMS)Who may use a key, which key type, how keys rotate and delete, and where KMS limits you.
- Security groups and network ACLs in layersChain security groups tier to tier, keep network ACLs for broad blocks, and know the ports and rules.