Skip to content
v2.273.0

RotationScheduleOptions Struct ​

Options to add a rotation schedule to a secret.

Example ​

ts
import * as lambda from 'aws-cdk-lib/aws-lambda';

declare const fn: lambda.Function;
const secret = new secretsmanager.Secret(this, 'Secret');

secret.addRotationSchedule('RotationSchedule', {
  rotationLambda: fn,
  automaticallyAfter: Duration.days(15),
  rotateImmediatelyOnUpdate: false, // default is true
});

Properties ​

automaticallyAfterDurationautomatically_afterDurationautomaticallyAfterDurationAutomaticallyAfterDurationAutomaticallyAfterDuration= Duration.days(30)#
Specifies the number of days after the previous rotation before Secrets Manager triggers the next automatic rotation.

The minimum value is 4 hours. The maximum value is 1000 days.

A value of zero (Duration.days(0)) will not create RotationRules.

hostedRotationHostedRotationhosted_rotationHostedRotationhostedRotationHostedRotationHostedRotationHostedRotationHostedRotationHostedRotation= either `rotationLambda` or `host…#
Hosted rotation.
default

Default: either rotationLambda or hostedRotation must be specified

rotateImmediatelyOnUpdatebooleanrotate_immediately_on_updateboolrotateImmediatelyOnUpdateBooleanRotateImmediatelyOnUpdateboolRotateImmediatelyOnUpdate*bool= true#
Specifies whether to rotate the secret immediately or wait until the next scheduled rotation window.
rotationLambdaIFunctionrotation_lambdaIFunctionrotationLambdaIFunctionRotationLambdaIFunctionRotationLambdaIFunction= either `rotationLambda` or `host…#
A Lambda function that can rotate the secret.
default

Default: either rotationLambda or hostedRotation must be specified