Control: 2.3.1 Ensure that encryption-at-rest is enabled for RDS Instances
Description
Amazon RDS encrypted DB instances use the industry standard AES-256 encryption algorithm to encrypt your data on the server that hosts your Amazon RDS DB instances. After your data is encrypted, Amazon RDS handles authentication of access and decryption of your data transparently with a minimal impact on performance.
Databases are likely to hold sensitive and critical data, it is highly recommended to implement encryption in order to protect your data from unauthorized access or disclosure. With RDS encryption enabled, the data stored on the instance's underlying storage, the automated backups, read replicas, and snapshots, are all encrypted.
Remediation
From Console:
- Login to the AWS Management Console and open the RDS dashboard at https://console.aws.amazon.com/rds/.
- In the left navigation panel, click on
Databases
. - Select the Database instance that needs to be encrypted.
- Click on
Actions
button placed at the top right and selectTake Snapshot
. - On the Take Snapshot page, enter a database name of which you want to take a snapshot in the
Snapshot Name
field and click onTake Snapshot
. - Select the newly created snapshot and click on the
Action
button placed at the top right and selectCopy snapshot
from the Action menu. - On the Make Copy of DB Snapshot page, perform the following:
- In the New DB Snapshot Identifier field, Enter a name for the
new snapshot
. - Check
Copy Tags
, New snapshot must have the same tags as the source snapshot. - Select
Yes
from theEnable Encryption
dropdown list to enable encryption, You can choose to use the AWS default encryption key or custom key from Master Key dropdown list.
- Click
Copy Snapshot
to create an encrypted copy of the selected instance snapshot. - Select the new Snapshot Encrypted Copy and click on the
Action
button placed at the top right and selectRestore Snapshot
button from the Action menu, This will restore the encrypted snapshot to a new database instance. - On the Restore DB Instance page, enter a unique name for the new database instance in the DB Instance Identifier field.
- Review the instance configuration details and click
Restore DB Instance
. - As the new instance provisioning process is completed can update application configuration to refer to the endpoint of the new Encrypted database instance Once the database endpoint is changed at the application level, can remove the unencrypted instance.
From Command Line:
- Run
describe-db-instances
command to list all RDS database names available in the selected AWS region, The command output should return database instance identifier.
aws rds describe-db-instances --region <region-name> --query 'DBInstances[*].DBInstanceIdentifier'
- Run
create-db-snapshot
command to create a snapshot for the selected database instance, The command output will return the new snapshot with name DB Snapshot Name.
aws rds create-db-snapshot --region <region-name> --db-snapshot-identifier <DB-Snapshot-Name> --db-instance-identifier <DB-Name>
- Now run
list-aliases
command to list the KMS keys aliases available in a specified region, The command output should return eachkey alias currently available
. For our RDS encryption the activation process, locate the ID of the AWS default KMS key.
aws kms list-aliases --region <region-name>
- Run
copy-db-snapshot
command using the default KMS key ID for RDS instances returned earlier to create an encrypted copy of the database instance snapshot, the command output will return theencrypted instance snapshot configuration
.
aws rds copy-db-snapshot --region <region-name> --source-db-snapshotidentifier <DB-Snapshot-Name> --target-db-snapshot-identifier <DB-SnapshotName-Encrypted> --copy-tags --kms-key-id <KMS-ID-For-RDS>
- Run
restore-db-instance-from-db-snapshot
command to restore the encrypted snapshot created at the previous step to a new database instance, if successful, the command output should return the new encrypted database instance configuration.
aws rds restore-db-instance-from-db-snapshot --region <region-name> --dbinstance-identifier <DB-Name-Encrypted> --db-snapshot-identifier <DBSnapshot-Name-Encrypted>
- Run
describe-db-instances
command to list all RDS database names, available in the selected AWS region, output will return database instance identifier name. Select encrypted database name that we just created DB-Name-Encrypted.
aws rds describe-db-instances --region <region-name> --query 'DBInstances[*].DBInstanceIdentifier'
- Run again
describe-db-instances
command using the RDS instance identifier returned earlier, to determine if the selected database instance is encrypted, the command output should return the encryption status True.
aws rds describe-db-instances --region <region-name> --db-instance-identifier <DB-Name-Encrypted> --query 'DBInstances[*].StorageEncrypted'
Usage
Run the control in your terminal:
powerpipe control run aws_compliance.control.cis_v300_2_3_1
Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run aws_compliance.control.cis_v300_2_3_1 --share
SQL
This control uses a named query:
rds_db_instance_encryption_at_rest_enabled