Skip to main content

createSecretManagerSecret

Creates Secrets Manager secret while adhering to same naming convention mentioned in Parameter naming

Example usage

YourStack.ts
import { SecretManagerUtil } from 'aws-cdk-lib-util';
...

export class YourStack extends Stack {
constructor(scope: Construct, id: string, props: IYourStackProps) {
super(scope, id, props);

const {
projectName,
stackEnv,
secret
} = props;
...
const paramName = 'db/rds/auth/';
const paramValue = {secret};

SecretManagerUtil.createSecretManagerSecret({
scope: this,
projectName,
stackEnv,
paramName: paramName,
value: paramValue,
});
...
}
}