# RotationScheduleOptions

Options to add a rotation schedule to a secret.

- Source: [`aws-secretsmanager/lib/rotation-schedule.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/aws-secretsmanager/lib/rotation-schedule.ts#L26)
- Type last changed: v2.88.0 · 20 Jul 2023

## 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

- `automaticallyAfter`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) = 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.

- `hostedRotation`: [HostedRotation](/cdk/api/v2/docs/aws-cdk-lib.aws_secretsmanager.HostedRotation.html) — Hosted rotation.

  **Default:** either `rotationLambda` or `hostedRotation` must be specified

- `rotateImmediatelyOnUpdate`: boolean = true — Specifies whether to rotate the secret immediately or wait until the next scheduled rotation window.

- `rotationLambda`: [IFunction](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.IFunction.html) — A Lambda function that can rotate the secret.

  **Default:** either `rotationLambda` or `hostedRotation` must be specified
