# CfnRotationScheduleProps

Properties for defining a `CfnRotationSchedule`.

Used as props by: [CfnRotationSchedule](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_secretsmanager.CfnRotationSchedule.html)

- Source: Generated at build time
- Type last changed: v2.230.0 · 26 Nov 2025

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_secretsmanager as secretsmanager } from 'aws-cdk-lib';
const cfnRotationScheduleProps: secretsmanager.CfnRotationScheduleProps = {
  secretId: 'secretId',

  // the properties below are optional
  externalSecretRotationMetadata: [{
    key: 'key',
    value: 'value',
  }],
  externalSecretRotationRoleArn: 'externalSecretRotationRoleArn',
  hostedRotationLambda: {
    rotationType: 'rotationType',

    // the properties below are optional
    excludeCharacters: 'excludeCharacters',
    kmsKeyArn: 'kmsKeyArn',
    masterSecretArn: 'masterSecretArn',
    masterSecretKmsKeyArn: 'masterSecretKmsKeyArn',
    rotationLambdaName: 'rotationLambdaName',
    runtime: 'runtime',
    superuserSecretArn: 'superuserSecretArn',
    superuserSecretKmsKeyArn: 'superuserSecretKmsKeyArn',
    vpcSecurityGroupIds: 'vpcSecurityGroupIds',
    vpcSubnetIds: 'vpcSubnetIds',
  },
  rotateImmediatelyOnUpdate: false,
  rotationLambdaArn: 'rotationLambdaArn',
  rotationRules: {
    automaticallyAfterDays: 123,
    duration: 'duration',
    scheduleExpression: 'scheduleExpression',
  },
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_secretsmanager as secretsmanager

cfn_rotation_schedule_props = secretsmanager.CfnRotationScheduleProps(
    secret_id="secretId",

    # the properties below are optional
    external_secret_rotation_metadata=[secretsmanager.CfnRotationSchedule.ExternalSecretRotationMetadataItemProperty(
        key="key",
        value="value"
    )],
    external_secret_rotation_role_arn="externalSecretRotationRoleArn",
    hosted_rotation_lambda=secretsmanager.CfnRotationSchedule.HostedRotationLambdaProperty(
        rotation_type="rotationType",

        # the properties below are optional
        exclude_characters="excludeCharacters",
        kms_key_arn="kmsKeyArn",
        master_secret_arn="masterSecretArn",
        master_secret_kms_key_arn="masterSecretKmsKeyArn",
        rotation_lambda_name="rotationLambdaName",
        runtime="runtime",
        superuser_secret_arn="superuserSecretArn",
        superuser_secret_kms_key_arn="superuserSecretKmsKeyArn",
        vpc_security_group_ids="vpcSecurityGroupIds",
        vpc_subnet_ids="vpcSubnetIds"
    ),
    rotate_immediately_on_update=False,
    rotation_lambda_arn="rotationLambdaArn",
    rotation_rules=secretsmanager.CfnRotationSchedule.RotationRulesProperty(
        automatically_after_days=123,
        duration="duration",
        schedule_expression="scheduleExpression"
    )
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.secretsmanager.*;

CfnRotationScheduleProps cfnRotationScheduleProps = CfnRotationScheduleProps.builder()
        .secretId("secretId")

        // the properties below are optional
        .externalSecretRotationMetadata(List.of(ExternalSecretRotationMetadataItemProperty.builder()
                .key("key")
                .value("value")
                .build()))
        .externalSecretRotationRoleArn("externalSecretRotationRoleArn")
        .hostedRotationLambda(HostedRotationLambdaProperty.builder()
                .rotationType("rotationType")

                // the properties below are optional
                .excludeCharacters("excludeCharacters")
                .kmsKeyArn("kmsKeyArn")
                .masterSecretArn("masterSecretArn")
                .masterSecretKmsKeyArn("masterSecretKmsKeyArn")
                .rotationLambdaName("rotationLambdaName")
                .runtime("runtime")
                .superuserSecretArn("superuserSecretArn")
                .superuserSecretKmsKeyArn("superuserSecretKmsKeyArn")
                .vpcSecurityGroupIds("vpcSecurityGroupIds")
                .vpcSubnetIds("vpcSubnetIds")
                .build())
        .rotateImmediatelyOnUpdate(false)
        .rotationLambdaArn("rotationLambdaArn")
        .rotationRules(RotationRulesProperty.builder()
                .automaticallyAfterDays(123)
                .duration("duration")
                .scheduleExpression("scheduleExpression")
                .build())
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.SecretsManager;

var cfnRotationScheduleProps = new CfnRotationScheduleProps {
    SecretId = "secretId",

    // the properties below are optional
    ExternalSecretRotationMetadata = new [] { new ExternalSecretRotationMetadataItemProperty {
        Key = "key",
        Value = "value"
    } },
    ExternalSecretRotationRoleArn = "externalSecretRotationRoleArn",
    HostedRotationLambda = new HostedRotationLambdaProperty {
        RotationType = "rotationType",

        // the properties below are optional
        ExcludeCharacters = "excludeCharacters",
        KmsKeyArn = "kmsKeyArn",
        MasterSecretArn = "masterSecretArn",
        MasterSecretKmsKeyArn = "masterSecretKmsKeyArn",
        RotationLambdaName = "rotationLambdaName",
        Runtime = "runtime",
        SuperuserSecretArn = "superuserSecretArn",
        SuperuserSecretKmsKeyArn = "superuserSecretKmsKeyArn",
        VpcSecurityGroupIds = "vpcSecurityGroupIds",
        VpcSubnetIds = "vpcSubnetIds"
    },
    RotateImmediatelyOnUpdate = false,
    RotationLambdaArn = "rotationLambdaArn",
    RotationRules = new RotationRulesProperty {
        AutomaticallyAfterDays = 123,
        Duration = "duration",
        ScheduleExpression = "scheduleExpression"
    }
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

cfnRotationScheduleProps := &CfnRotationScheduleProps{
	SecretId: jsii.String("secretId"),

	// the properties below are optional
	ExternalSecretRotationMetadata: []interface{}{
		&ExternalSecretRotationMetadataItemProperty{
			Key: jsii.String("key"),
			Value: jsii.String("value"),
		},
	},
	ExternalSecretRotationRoleArn: jsii.String("externalSecretRotationRoleArn"),
	HostedRotationLambda: &HostedRotationLambdaProperty{
		RotationType: jsii.String("rotationType"),

		// the properties below are optional
		ExcludeCharacters: jsii.String("excludeCharacters"),
		KmsKeyArn: jsii.String("kmsKeyArn"),
		MasterSecretArn: jsii.String("masterSecretArn"),
		MasterSecretKmsKeyArn: jsii.String("masterSecretKmsKeyArn"),
		RotationLambdaName: jsii.String("rotationLambdaName"),
		Runtime: jsii.String("runtime"),
		SuperuserSecretArn: jsii.String("superuserSecretArn"),
		SuperuserSecretKmsKeyArn: jsii.String("superuserSecretKmsKeyArn"),
		VpcSecurityGroupIds: jsii.String("vpcSecurityGroupIds"),
		VpcSubnetIds: jsii.String("vpcSubnetIds"),
	},
	RotateImmediatelyOnUpdate: jsii.Boolean(false),
	RotationLambdaArn: jsii.String("rotationLambdaArn"),
	RotationRules: &RotationRulesProperty{
		AutomaticallyAfterDays: jsii.Number(123),
		Duration: jsii.String("duration"),
		ScheduleExpression: jsii.String("scheduleExpression"),
	},
}
```

## Properties

- `externalSecretRotationMetadata`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnRotationSchedule.ExternalSecretRotationMetadataItemProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_secretsmanager.CfnRotationSchedule.ExternalSecretRotationMetadataItemProperty.html)[] — The list of metadata needed to successfully rotate a managed external secret.

- `externalSecretRotationRoleArn`: string — The ARN of the IAM role that is used by Secrets Manager to rotate a managed external secret.

- `hostedRotationLambda`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnRotationSchedule.HostedRotationLambdaProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_secretsmanager.CfnRotationSchedule.HostedRotationLambdaProperty.html) — Creates a new Lambda rotation function based on one of the [Secrets Manager rotation function templates](https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_available-rotation-templates.html) . To use a rotation function that already exists, specify `RotationLambdaARN` instead.

  You must specify `Transform: AWS::SecretsManager-2024-09-16` at the beginning of the CloudFormation template. Transforms are macros hosted by AWS CloudFormation that help you create and manage complex infrastructure. The `Transform: AWS::SecretsManager-2024-09-16` transform automatically extends the CloudFormation stack to include a nested stack (of type `AWS::CloudFormation::Stack` ), which then creates and updates on your behalf during subsequent stack operations, the appropriate rotation Lambda function for your database or service. For general information on transforms, see the [AWS CloudFormation documentation.](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/transform-reference.html)

  For Amazon RDS master user credentials, see [AWS::RDS::DBCluster MasterUserSecret](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-dbcluster-masterusersecret.html) .

  For Amazon Redshift admin user credentials, see [AWS::Redshift::Cluster](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-cluster.html) .

- `rotateImmediatelyOnUpdate`: boolean | [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) — Determines whether to rotate the secret immediately or wait until the next scheduled rotation window when the rotation schedule is updated.

  The rotation schedule is defined in `RotationRules` .

  The default for `RotateImmediatelyOnUpdate` is `true` . If you don't specify this value, Secrets Manager rotates the secret immediately.

  If you set `RotateImmediatelyOnUpdate` to `false` , Secrets Manager tests the rotation configuration by running the [`testSecret` step](https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotate-secrets_how.html) of the Lambda rotation function. This test creates an `AWSPENDING` version of the secret and then removes it.

  > When changing an existing rotation schedule and setting `RotateImmediatelyOnUpdate` to `false` :
  >
  > - If using `AutomaticallyAfterDays` or a `ScheduleExpression` with `rate()` , the previously scheduled rotation might still occur.
  > - To prevent unintended rotations, use a `ScheduleExpression` with `cron()` for granular control over rotation windows.

  Rotation is an asynchronous process. For more information, see [How rotation works](https://docs.aws.amazon.com/secretsmanager/latest/userguide/rotate-secrets_how.html) .

- `rotationLambdaArn`: string — The ARN of an existing Lambda rotation function.

  To specify a rotation function that is also defined in this template, use the [Ref](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-ref.html) function.

  For Amazon RDS master user credentials, see [AWS::RDS::DBCluster MasterUserSecret](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-rds-dbcluster-masterusersecret.html) .

  For Amazon Redshift admin user credentials, see [AWS::Redshift::Cluster](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-redshift-cluster.html) .

  To create a new rotation function based on one of the [Secrets Manager rotation function templates](https://docs.aws.amazon.com/secretsmanager/latest/userguide/reference_available-rotation-templates.html) , specify `HostedRotationLambda` instead.

- `rotationRules`: [IResolvable](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnRotationSchedule.RotationRulesProperty](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_secretsmanager.CfnRotationSchedule.RotationRulesProperty.html) — A structure that defines the rotation configuration for this secret.

- `secretId`: string (required) — The ARN or name of the secret to rotate. This is unique for each rotation schedule definition.

  To reference a secret also created in this template, use the [Ref](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-ref.html) function with the secret's logical ID.
