To create, manage, and retrieve secrets in a CDK app, you can use the AWS Secrets Manager Construct Library, which contains ResourcePolicy
, RotationSchedule
, Secret
, SecretRotation
, and SecretTargetAttachment
constructs.
A good practice for using secrets in CDK applications is to first create the secret by using console or the CLI, and then import the secret into your CDK application.
For examples, see:
For more information about the CDK, see the AWS Cloud Development Kit (AWS CDK) v2 Developer Guide.