Triage and Remediation
Remediation
Amazon RDS does not support enabling encryption on an existing unencrypted DB instance. However, you can achieve encryption by creating a new encrypted instance and migrating the data. Here are the steps for AWS Console:Using Console
Using Console
To remediate the misconfiguration of RDS instances not having encryption enabled in AWS, you can follow these steps using the AWS Management Console:
- Login to AWS Console: Go to the AWS Management Console and login with your credentials.
- Navigate to RDS Dashboard: Click on the “Services” dropdown menu at the top of the page and select “RDS” under the Database category.
- Create a Snapshot of the Unencrypted DB Instance a. Select your DB instance. b. Click on Actions and choose Take snapshot. c. Provide a unique Snapshot Identifier and create the snapshot. d. Copy the Snapshot with Encryption
- Create Encrypted Snapshot from Unencrypted Snapshot a. In the RDS Dashboard, go to Snapshots and select the snapshot you just created. b. Click on Actions and choose Copy snapshot. c. In the copy dialog, enable Encryption by selecting your desired AWS KMS key. d. Specify a new identifier for the encrypted snapshot and start the copy process.
- Restore a New Encrypted DB Instance from the Encrypted Snapshot a. Once the encrypted snapshot is available, select it. b. Click on Actions and choose Restore snapshot. c. Provide a new DB instance identifier and adjust the instance settings as needed. d. Launch the new encrypted instance.
Using CLI
Using CLI
Amazon RDS does not support enabling encryption on an existing unencrypted DB instance. However, you can achieve encryption by creating a new encrypted instance and migrating the data. Here are the steps for AWS CLI:
-
Identify the RDS Instances without Encryption Enabled:
Run the following AWS CLI command to list all RDS instances without encryption enabled:
-
Create a Snapshot:
For each RDS instance identified in the previous step, create a db snapshot using the following command:
Replace
<instance-identifier>
with the identifier of the RDS instance that needs encryption enabled. - Iterate through all the instances and perform below steps:
-
Copy the Snapshot with Encryption Enabled:
Replace
<snapshot-id>
with the RDS instance snapshot identifier created in the above step. -
Restore a New Encrypted DB Instance from the Encrypted Snapshot:
Once the encryption modification is complete, verify that encryption is enabled for the RDS instance by running:
Replace
<encrypted-snapshot-id>
with the Encrypted snapshot identifier created in the above step. -
(Optional) Delete Old Unencrypted Instances:
Using Python
Using Python
Amazon RDS does not support enabling encryption on an existing unencrypted DB instance. However, you can achieve encryption by creating a new encrypted instance and migrating the data. Here are the steps using Python:
-
Import the necessary Python libraries:
-
Initialize the AWS RDS client:
-
Get a list of all RDS instances:
-
Create a snapshot of the current unencrypted DB instance:
-
Create new snapshot with Encryption:
-
Restore to create a new Encrypted database: