RotationScheduleOptions Struct
Options to add a rotation schedule to a secret.
| Source | aws-secretsmanager/lib/rotation-schedule.ts |
|---|---|
| Type last changed |
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
});
python
import aws_cdk.aws_lambda as lambda_
# fn: lambda.Function
secret = secretsmanager.Secret(self, "Secret")
secret.add_rotation_schedule("RotationSchedule",
rotation_lambda=fn,
automatically_after=Duration.days(15),
rotate_immediately_on_update=False
)
java
import software.amazon.awscdk.services.lambda.*;
Function fn;
Secret secret = new Secret(this, "Secret");
secret.addRotationSchedule("RotationSchedule", RotationScheduleOptions.builder()
.rotationLambda(fn)
.automaticallyAfter(Duration.days(15))
.rotateImmediatelyOnUpdate(false)
.build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
using Amazon.CDK.AWS.Lambda;
Function fn;
var secret = new Secret(this, "Secret");
secret.AddRotationSchedule("RotationSchedule", new RotationScheduleOptions {
RotationLambda = fn,
AutomaticallyAfter = Duration.Days(15),
RotateImmediatelyOnUpdate = false
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
import lambda "github.com/aws/aws-cdk-go/awscdk"
var fn Function
secret := secretsmanager.NewSecret(this, jsii.String("Secret"))
secret.addRotationSchedule(jsii.String("RotationSchedule"), &RotationScheduleOptions{
RotationLambda: fn,
AutomaticallyAfter: awscdk.Duration_Days(jsii.Number(15)),
RotateImmediatelyOnUpdate: jsii.Boolean(false),
})
Properties
automaticallyAfteroptionalDurationautomatically_afteroptionalDurationautomaticallyAfteroptionalDurationAutomaticallyAfteroptionalDurationAutomaticallyAfteroptionalDuration = 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.
hostedRotationoptionalHostedRotationhosted_rotationoptionalHostedRotationhostedRotationoptionalHostedRotationHostedRotationoptionalHostedRotationHostedRotationoptionalHostedRotation #Hosted rotation.
Default: either rotationLambda or hostedRotation must be specified
rotateImmediatelyOnUpdateoptionalbooleanrotate_immediately_on_updateoptionalboolrotateImmediatelyOnUpdateoptionalBooleanRotateImmediatelyOnUpdateoptionalboolRotateImmediatelyOnUpdateoptional*bool = true #Specifies whether to rotate the secret immediately or wait until the next scheduled rotation window.