How to update secret values of secret manger in CDK?

1.6k Views Asked by At

My secret manager is created with credential of RDS in CDK, with DatabaseCluster and credential param in it. Now i want to update some value in that secretmanager.

How can i update secret value of secret manager in CDK?

2

There are 2 best solutions below

0
On

There isn't a great way to do this, and that's by design. Anything you put in the CDK has to be in your CFN template, and then it's no longer secret.

You'll need to find a process outside of the CDK and CFN to update those values.

0
On

The problem is, if you inject the secret as a string in your CDK code, it will show up in the complied CloudFormation output.

There are a hot debate about this topic here

I solve this problem by update the secret by AWS CLI

aws secretsmanager put-secret-value --secret-id your_secret_arn --secret-string your_secret