Skip to content
v2.278.0

CfnRotationScheduleProps Struct ​

Properties for defining a CfnRotationSchedule.

Example ​

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
# 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
// 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();
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"
    }
};
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 ​

externalSecretRotationMetadataoptionalIResolvable | IResolvable | CfnRotationSchedule.ExternalSecretRotationMetadataItemProperty[]external_secret_rotation_metadataoptionaltyping.Union[IResolvable, typing.List[typing.Union[IResolvable, ExternalSecretRotationMetadataItemProperty]]]externalSecretRotationMetadataoptionalIResolvableExternalSecretRotationMetadataoptionalIResolvableExternalSecretRotationMetadataoptionalinterface{} #
The list of metadata needed to successfully rotate a managed external secret.
externalSecretRotationRoleArnoptionalstringexternal_secret_rotation_role_arnoptionalstrexternalSecretRotationRoleArnoptionalStringExternalSecretRotationRoleArnoptionalstringExternalSecretRotationRoleArnoptional*string #
The ARN of the IAM role that is used by Secrets Manager to rotate a managed external secret.
hostedRotationLambdaoptionalIResolvable | CfnRotationSchedule.HostedRotationLambdaPropertyhosted_rotation_lambdaoptionaltyping.Union[IResolvable, HostedRotationLambdaProperty]hostedRotationLambdaoptionalIResolvableHostedRotationLambdaoptionalIResolvableHostedRotationLambdaoptionalinterface{} #
Creates a new Lambda rotation function based on one of the Secrets Manager rotation function templates . To use a rotation function that already exists, specify `RotationLambdaARN` instead.
notes

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.

For Amazon RDS master user credentials, see AWS::RDS::DBCluster MasterUserSecret .

For Amazon Redshift admin user credentials, see AWS::Redshift::Cluster .

rotateImmediatelyOnUpdateoptionalboolean | IResolvablerotate_immediately_on_updateoptionaltyping.Union[bool, IResolvable]rotateImmediatelyOnUpdateoptionalBooleanRotateImmediatelyOnUpdateoptionalboolRotateImmediatelyOnUpdateoptionalinterface{} #
Determines whether to rotate the secret immediately or wait until the next scheduled rotation window when the rotation schedule is updated.
notes

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

rotationLambdaArnoptionalstringrotation_lambda_arnoptionalstrrotationLambdaArnoptionalStringRotationLambdaArnoptionalstringRotationLambdaArnoptional*string #
The ARN of an existing Lambda rotation function.
notes

To specify a rotation function that is also defined in this template, use the Ref function.

For Amazon RDS master user credentials, see AWS::RDS::DBCluster MasterUserSecret .

For Amazon Redshift admin user credentials, see AWS::Redshift::Cluster .

To create a new rotation function based on one of the Secrets Manager rotation function templates , specify HostedRotationLambda instead.

rotationRulesoptionalIResolvable | CfnRotationSchedule.RotationRulesPropertyrotation_rulesoptionaltyping.Union[IResolvable, RotationRulesProperty]rotationRulesoptionalIResolvableRotationRulesoptionalIResolvableRotationRulesoptionalinterface{} #
A structure that defines the rotation configuration for this secret.
secretIdstringsecret_idstrsecretIdStringSecretIdstringSecretId*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 function with the secret's logical ID.