Home > Back-end >  Rotating a Secret Using a Custom Lambda Function
Rotating a Secret Using a Custom Lambda Function

Time:11-12

How to write a lambda for a rotating secret (CDK in Typescript)where password changes every hour .

const templatedSecret = new secretsmanager.Secret(this, 'TemplatedSecret', {
      generateSecretString: {
        secretStringTemplate: JSON.stringify({ username: 'user' }),
        generateStringKey: 'password',
      },
    });

    new iam.User(this, 'OtherUser', {
      userName: templatedSecret.secretValueFromJson('username').toString(),
      password: templatedSecret.secretValueFromJson('password'),
    });

till now i only have this code and for reference i have enter image description here

  • Related