What's the correct process to change a production RDS database from non-encrypted to encrypted using AWS CDK (python)?

0

We have deployed an RDS database without encryption that is being used in production. Everything has been deployed using AWS CDK in Python. Now we need to start storing sensitive information like for example customers bank account information. Due to this we want to make sure our database is encrypted at rest.

I've read that the process is to make a database snapshot, then make an encrypted copy, then restore that encrypted copy, etc. But we probably also need to create a KMS Key.

How would we do this process while using the AWS CDK? The goal is to end up with an encrypted copy and no "drift" in our CDK.

Here is the basic code we are using to create our instance

database = rds.DatabaseInstance(self, 'Database',
	instance_identifier='example',
	database_name='example',
	engine=rds.DatabaseInstanceEngine.postgres(
		version=rds.PostgresEngineVersion.VER_15_2
	),
	instance_type=ec2.InstanceType.of(ec2.InstanceClass.T4G, ec2.InstanceSize.MICRO),
	vpc=vpc,
	vpc_subnets=ec2.SubnetSelection( subnet_type=ec2.SubnetType.PUBLIC),
	credentials=rds.Credentials.from_password(
		username='example',
		password='example123456'
	),
	storage_type=rds.StorageType.GP3,
	allocated_storage=20,
	max_allocated_storage=100,
	backup_retention=30,
	preferred_backup_window='21:00-21:30',
	removal_policy=core.RemovalPolicy.RETAIN,
	delete_automated_backups=False
)
  • Where you able to achieve the migration. I am looking to do the exact same thing.

Alvaro
已提問 8 個月前檢視次數 417 次
1 個回答
0
profile pictureAWS
專家
已回答 8 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南