CfnRotationSchedule
- class aws_cdk.aws_secretsmanager.CfnRotationSchedule(scope, id, *, secret_id, hosted_rotation_lambda=None, rotate_immediately_on_update=None, rotation_lambda_arn=None, rotation_rules=None)
Bases:
CfnResource
A CloudFormation
AWS::SecretsManager::RotationSchedule
.Sets the rotation schedule and Lambda rotation function for a secret. For more information, see How rotation works .
For Amazon RDS master user credentials, see AWS::RDS::DBCluster MasterUserSecret .
For the rotation function, you have two options:
You can create a new rotation function based on one of the Secrets Manager rotation function templates by using
HostedRotationLambda
.You can choose an existing rotation function by using
RotationLambdaARN
.
For database secrets, if you define both the secret and the database or service in the AWS CloudFormation template, then you need to define the AWS::SecretsManager::SecretTargetAttachment resource to populate the secret with the connection details of the database or service before you attempt to configure rotation.
- CloudformationResource:
AWS::SecretsManager::RotationSchedule
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_secretsmanager as secretsmanager cfn_rotation_schedule = secretsmanager.CfnRotationSchedule(self, "MyCfnRotationSchedule", secret_id="secretId", # the properties below are optional 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" ) )
Create a new
AWS::SecretsManager::RotationSchedule
.- Parameters:
scope (
Construct
) –scope in which this resource is defined.
id (
str
) –scoped id of the resource.
secret_id (
str
) – The ARN or name of the secret to rotate. To reference a secret also created in this template, use the Ref function with the secret’s logical ID.hosted_rotation_lambda (
Union
[HostedRotationLambdaProperty
,Dict
[str
,Any
],IResolvable
,None
]) –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. For Amazon RDS master user credentials, see AWS::RDS::DBCluster MasterUserSecret .rotate_immediately_on_update (
Union
[bool
,IResolvable
,None
]) –Specifies whether to rotate the secret immediately or wait until the next scheduled rotation window. The rotation schedule is defined in
RotationRules
. If you don’t immediately rotate the secret, 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. The test creates anAWSPENDING
version of the secret and then removes it. If you don’t specify this value, then by default, Secrets Manager rotates the secret immediately. Rotation is an asynchronous process. For more information, see How rotation works .rotation_lambda_arn (
Optional
[str
]) –The ARN of an existing Lambda rotation function. 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 . To create a new rotation function based on one of the Secrets Manager rotation function templates , specify
HostedRotationLambda
instead.rotation_rules (
Union
[IResolvable
,RotationRulesProperty
,Dict
[str
,Any
],None
]) – A structure that defines the rotation configuration for this secret.
Methods
- add_deletion_override(path)
Syntactic sugar for
addOverride(path, undefined)
.- Parameters:
path (
str
) – The path of the value to delete.- Return type:
None
- add_depends_on(target)
Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.
- Parameters:
target (
CfnResource
) –- Return type:
None
- add_metadata(key, value)
Add a value to the CloudFormation Resource Metadata.
- Parameters:
key (
str
) –value (
Any
) –
- See:
- Return type:
None
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- add_override(path, value)
Adds an override to the synthesized CloudFormation resource.
To add a property override, either use
addPropertyOverride
or prefixpath
with “Properties.” (i.e.Properties.TopicName
).If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.
To include a literal
.
in the property name, prefix with a\
. In most programming languages you will need to write this as"\\."
because the\
itself will need to be escaped.For example:
cfn_resource.add_override("Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes", ["myattribute"]) cfn_resource.add_override("Properties.GlobalSecondaryIndexes.1.ProjectionType", "INCLUDE")
would add the overrides Example:
"Properties": { "GlobalSecondaryIndexes": [ { "Projection": { "NonKeyAttributes": [ "myattribute" ] ... } ... }, { "ProjectionType": "INCLUDE" ... }, ] ... }
The
value
argument toaddOverride
will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.- Parameters:
path (
str
) –The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.
value (
Any
) –The value. Could be primitive or complex.
- Return type:
None
- add_property_deletion_override(property_path)
Adds an override that deletes the value of a property from the resource definition.
- Parameters:
property_path (
str
) – The path to the property.- Return type:
None
- add_property_override(property_path, value)
Adds an override to a resource property.
Syntactic sugar for
addOverride("Properties.<...>", value)
.- Parameters:
property_path (
str
) – The path of the property.value (
Any
) – The value.
- Return type:
None
- apply_removal_policy(policy=None, *, apply_to_update_replace_policy=None, default=None)
Sets the deletion policy of the resource based on the removal policy specified.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.
The resource can be deleted (
RemovalPolicy.DESTROY
), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN
).- Parameters:
policy (
Optional
[RemovalPolicy
]) –apply_to_update_replace_policy (
Optional
[bool
]) – Apply the same deletion policy to the resource’s “UpdateReplacePolicy”. Default: truedefault (
Optional
[RemovalPolicy
]) – The default policy to apply in case the removal policy is not defined. Default: - Default value is resource specific. To determine the default value for a resoure, please consult that specific resource’s documentation.
- Return type:
None
- get_att(attribute_name)
Returns a token for an runtime attribute of this resource.
Ideally, use generated attribute accessors (e.g.
resource.arn
), but this can be used for future compatibility in case there is no generated attribute.- Parameters:
attribute_name (
str
) – The name of the attribute.- Return type:
- get_metadata(key)
Retrieve a value value from the CloudFormation Resource Metadata.
- Parameters:
key (
str
) –- See:
- Return type:
Any
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- inspect(inspector)
Examines the CloudFormation resource and discloses attributes.
- Parameters:
inspector (
TreeInspector
) –tree inspector to collect and process attributes.
- Return type:
None
- override_logical_id(new_logical_id)
Overrides the auto-generated logical ID with a specific ID.
- Parameters:
new_logical_id (
str
) – The new logical ID to use for this stack element.- Return type:
None
- to_string()
Returns a string representation of this construct.
- Return type:
str
- Returns:
a string representation of this resource
Attributes
- CFN_RESOURCE_TYPE_NAME = 'AWS::SecretsManager::RotationSchedule'
- cfn_options
Options for this resource, such as condition, update policy etc.
- cfn_resource_type
AWS resource type.
- creation_stack
return:
the stack trace of the point where this Resource was created from, sourced from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most node +internal+ entries filtered.
- hosted_rotation_lambda
//docs.aws.amazon.com/secretsmanager/latest/userguide/reference_available-rotation-templates.html>`_ . To use a rotation function that already exists, specify
RotationLambdaARN
instead.For Amazon RDS master user credentials, see AWS::RDS::DBCluster MasterUserSecret .
- Link:
- Type:
Creates a new Lambda rotation function based on one of the `Secrets Manager rotation function templates <https
- logical_id
The logical ID for this CloudFormation stack element.
The logical ID of the element is calculated from the path of the resource node in the construct tree.
To override this value, use
overrideLogicalId(newLogicalId)
.- Returns:
the logical ID as a stringified token. This value will only get resolved during synthesis.
- node
The construct tree node associated with this construct.
- ref
Return a string that will be resolved to a CloudFormation
{ Ref }
for this element.If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through
Lazy.any({ produce: resource.ref })
.
- rotate_immediately_on_update
Specifies whether to rotate the secret immediately or wait until the next scheduled rotation window.
The rotation schedule is defined in
RotationRules
.If you don’t immediately rotate the secret, 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. The test creates anAWSPENDING
version of the secret and then removes it.If you don’t specify this value, then by default, Secrets Manager rotates the secret immediately.
Rotation is an asynchronous process. For more information, see How rotation works .
- rotation_lambda_arn
The ARN of an existing Lambda rotation function.
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 .
To create a new rotation function based on one of the Secrets Manager rotation function templates , specify
HostedRotationLambda
instead.
- rotation_rules
A structure that defines the rotation configuration for this secret.
- secret_id
The ARN or name of the secret to rotate.
To reference a secret also created in this template, use the Ref function with the secret’s logical ID.
- stack
The stack in which this element is defined.
CfnElements must be defined within a stack scope (directly or indirectly).
Static Methods
- classmethod is_cfn_element(x)
Returns
true
if a construct is a stack element (i.e. part of the synthesized cloudformation template).Uses duck-typing instead of
instanceof
to allow stack elements from different versions of this library to be included in the same stack.- Parameters:
x (
Any
) –- Return type:
bool
- Returns:
The construct as a stack element or undefined if it is not a stack element.
- classmethod is_cfn_resource(construct)
Check whether the given construct is a CfnResource.
- Parameters:
construct (
IConstruct
) –- Return type:
bool
- classmethod is_construct(x)
Return whether the given object is a Construct.
- Parameters:
x (
Any
) –- Return type:
bool
HostedRotationLambdaProperty
- class CfnRotationSchedule.HostedRotationLambdaProperty(*, rotation_type, exclude_characters=None, kms_key_arn=None, master_secret_arn=None, master_secret_kms_key_arn=None, rotation_lambda_name=None, runtime=None, superuser_secret_arn=None, superuser_secret_kms_key_arn=None, vpc_security_group_ids=None, vpc_subnet_ids=None)
Bases:
object
Creates a new Lambda rotation function based on one of the Secrets Manager rotation function templates .
You must specify
Transform: AWS::SecretsManager-2020-07-23
at the beginning of the CloudFormation template.For Amazon RDS master user credentials, see AWS::RDS::DBCluster MasterUserSecret .
- Parameters:
rotation_type (
str
) – The rotation template to base the rotation function on, one of the following:. -MySQLSingleUser
to use the template SecretsManagerRDSMySQLRotationSingleUser . -MySQLMultiUser
to use the template SecretsManagerRDSMySQLRotationMultiUser . -PostgreSQLSingleUser
to use the template SecretsManagerRDSPostgreSQLRotationSingleUser -PostgreSQLMultiUser
to use the template SecretsManagerRDSPostgreSQLRotationMultiUser . -OracleSingleUser
to use the template SecretsManagerRDSOracleRotationSingleUser . -OracleMultiUser
to use the template SecretsManagerRDSOracleRotationMultiUser . -MariaDBSingleUser
to use the template SecretsManagerRDSMariaDBRotationSingleUser . -MariaDBMultiUser
to use the template SecretsManagerRDSMariaDBRotationMultiUser . -SQLServerSingleUser
to use the template SecretsManagerRDSSQLServerRotationSingleUser . -SQLServerMultiUser
to use the template SecretsManagerRDSSQLServerRotationMultiUser . -RedshiftSingleUser
to use the template SecretsManagerRedshiftRotationSingleUsr . -RedshiftMultiUser
to use the template SecretsManagerRedshiftRotationMultiUser . -MongoDBSingleUser
to use the template SecretsManagerMongoDBRotationSingleUser . -MongoDBMultiUser
to use the template SecretsManagerMongoDBRotationMultiUser .exclude_characters (
Optional
[str
]) – A string of the characters that you don’t want in the password.kms_key_arn (
Optional
[str
]) – The ARN of the KMS key that Secrets Manager uses to encrypt the secret. If you don’t specify this value, then Secrets Manager uses the keyaws/secretsmanager
. Ifaws/secretsmanager
doesn’t yet exist, then Secrets Manager creates it for you automatically the first time it encrypts the secret value.master_secret_arn (
Optional
[str
]) – The ARN of the secret that contains superuser credentials, if you use the Alternating users rotation strategy . CloudFormation grants the execution role for the Lambda rotation functionGetSecretValue
permission to the secret in this property. For more information, see Lambda rotation function execution role permissions for Secrets Manager . You must create the superuser secret before you can set this property. You must also include the superuser secret ARN as a key in the JSON of the rotating secret so that the Lambda rotation function can find it. CloudFormation does not hardcode secret ARNs in the Lambda rotation function, so you can use the function to rotate multiple secrets. For more information, see JSON structure of Secrets Manager secrets . You can specifyMasterSecretArn
orSuperuserSecretArn
but not both. They represent the same superuser secret.master_secret_kms_key_arn (
Optional
[str
]) –The ARN of the KMS key that Secrets Manager used to encrypt the superuser secret, if you use the alternating users strategy and the superuser secret is encrypted with a customer managed key. You don’t need to specify this property if the superuser secret is encrypted using the key
aws/secretsmanager
. CloudFormation grants the execution role for the Lambda rotation functionDecrypt
,DescribeKey
, andGenerateDataKey
permission to the key in this property. For more information, see Lambda rotation function execution role permissions for Secrets Manager . You can specifyMasterSecretKmsKeyArn
orSuperuserSecretKmsKeyArn
but not both. They represent the same superuser secret KMS key .rotation_lambda_name (
Optional
[str
]) – The name of the Lambda rotation function.runtime (
Optional
[str
]) – By default, CloudFormation deploys Python 3.9 binaries for the rotation function. To use a different version of Python, you must do the following two steps:. - Deploy the matching version Python binaries with your rotation function. - Set the version number in this field. For example, for Python 3.7, enter python3.7 If you only do one of the steps, your rotation function will be incompatible with the binaries. For more information, see Why did my Lambda rotation function fail with a “pg module not found” error .superuser_secret_arn (
Optional
[str
]) –The ARN of the secret that contains superuser credentials, if you use the Alternating users rotation strategy . CloudFormation grants the execution role for the Lambda rotation function
GetSecretValue
permission to the secret in this property. For more information, see Lambda rotation function execution role permissions for Secrets Manager . You must create the superuser secret before you can set this property. You must also include the superuser secret ARN as a key in the JSON of the rotating secret so that the Lambda rotation function can find it. CloudFormation does not hardcode secret ARNs in the Lambda rotation function, so you can use the function to rotate multiple secrets. For more information, see JSON structure of Secrets Manager secrets . You can specifyMasterSecretArn
orSuperuserSecretArn
but not both. They represent the same superuser secret.superuser_secret_kms_key_arn (
Optional
[str
]) –The ARN of the KMS key that Secrets Manager used to encrypt the superuser secret, if you use the alternating users strategy and the superuser secret is encrypted with a customer managed key. You don’t need to specify this property if the superuser secret is encrypted using the key
aws/secretsmanager
. CloudFormation grants the execution role for the Lambda rotation functionDecrypt
,DescribeKey
, andGenerateDataKey
permission to the key in this property. For more information, see Lambda rotation function execution role permissions for Secrets Manager . You can specifyMasterSecretKmsKeyArn
orSuperuserSecretKmsKeyArn
but not both. They represent the same superuser secret KMS key .vpc_security_group_ids (
Optional
[str
]) – A comma-separated list of security group IDs applied to the target database. The template applies the same security groups as on the Lambda rotation function that is created as part of this stack.vpc_subnet_ids (
Optional
[str
]) – A comma separated list of VPC subnet IDs of the target database network. The Lambda rotation function is in the same subnet group.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_secretsmanager as secretsmanager hosted_rotation_lambda_property = 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" )
Attributes
- exclude_characters
A string of the characters that you don’t want in the password.
- kms_key_arn
The ARN of the KMS key that Secrets Manager uses to encrypt the secret.
If you don’t specify this value, then Secrets Manager uses the key
aws/secretsmanager
. Ifaws/secretsmanager
doesn’t yet exist, then Secrets Manager creates it for you automatically the first time it encrypts the secret value.
- master_secret_arn
//docs.aws.amazon.com/secretsmanager/latest/userguide/rotating-secrets-required-permissions-function.html>`_ .
You must create the superuser secret before you can set this property.
You must also include the superuser secret ARN as a key in the JSON of the rotating secret so that the Lambda rotation function can find it. CloudFormation does not hardcode secret ARNs in the Lambda rotation function, so you can use the function to rotate multiple secrets. For more information, see JSON structure of Secrets Manager secrets .
You can specify
MasterSecretArn
orSuperuserSecretArn
but not both. They represent the same superuser secret.- Link:
- Type:
The ARN of the secret that contains superuser credentials, if you use the `Alternating users rotation strategy <https
- Type:
//docs.aws.amazon.com/secretsmanager/latest/userguide/rotating-secrets_strategies.html#rotating-secrets-two-users>`_ . CloudFormation grants the execution role for the Lambda rotation function
GetSecretValue
permission to the secret in this property. For more information, see `Lambda rotation function execution role permissions for Secrets Manager <https
- master_secret_kms_key_arn
//docs.aws.amazon.com/secretsmanager/latest/userguide/rotating-secrets-required-permissions-function.html>`_ .
You can specify
MasterSecretKmsKeyArn
orSuperuserSecretKmsKeyArn
but not both. They represent the same superuser secret KMS key .- Link:
- Type:
The ARN of the KMS key that Secrets Manager used to encrypt the superuser secret, if you use the `alternating users strategy <https
- Type:
//docs.aws.amazon.com/secretsmanager/latest/userguide/rotating-secrets_strategies.html#rotating-secrets-two-users>`_ and the superuser secret is encrypted with a customer managed key. You don’t need to specify this property if the superuser secret is encrypted using the key
aws/secretsmanager
. CloudFormation grants the execution role for the Lambda rotation functionDecrypt
,DescribeKey
, andGenerateDataKey
permission to the key in this property. For more information, see `Lambda rotation function execution role permissions for Secrets Manager <https
- rotation_lambda_name
The name of the Lambda rotation function.
- rotation_type
.
MySQLSingleUser
to use the template SecretsManagerRDSMySQLRotationSingleUser .MySQLMultiUser
to use the template SecretsManagerRDSMySQLRotationMultiUser .PostgreSQLSingleUser
to use the template SecretsManagerRDSPostgreSQLRotationSingleUserPostgreSQLMultiUser
to use the template SecretsManagerRDSPostgreSQLRotationMultiUser .OracleSingleUser
to use the template SecretsManagerRDSOracleRotationSingleUser .OracleMultiUser
to use the template SecretsManagerRDSOracleRotationMultiUser .MariaDBSingleUser
to use the template SecretsManagerRDSMariaDBRotationSingleUser .MariaDBMultiUser
to use the template SecretsManagerRDSMariaDBRotationMultiUser .SQLServerSingleUser
to use the template SecretsManagerRDSSQLServerRotationSingleUser .SQLServerMultiUser
to use the template SecretsManagerRDSSQLServerRotationMultiUser .RedshiftSingleUser
to use the template SecretsManagerRedshiftRotationSingleUsr .RedshiftMultiUser
to use the template SecretsManagerRedshiftRotationMultiUser .MongoDBSingleUser
to use the template SecretsManagerMongoDBRotationSingleUser .MongoDBMultiUser
to use the template SecretsManagerMongoDBRotationMultiUser .
- Link:
- Type:
The rotation template to base the rotation function on, one of the following
- runtime
.
Deploy the matching version Python binaries with your rotation function.
Set the version number in this field. For example, for Python 3.7, enter python3.7
If you only do one of the steps, your rotation function will be incompatible with the binaries. For more information, see Why did my Lambda rotation function fail with a “pg module not found” error .
- Link:
- Type:
By default, CloudFormation deploys Python 3.9 binaries for the rotation function. To use a different version of Python, you must do the following two steps
- superuser_secret_arn
//docs.aws.amazon.com/secretsmanager/latest/userguide/rotating-secrets-required-permissions-function.html>`_ .
You must create the superuser secret before you can set this property.
You must also include the superuser secret ARN as a key in the JSON of the rotating secret so that the Lambda rotation function can find it. CloudFormation does not hardcode secret ARNs in the Lambda rotation function, so you can use the function to rotate multiple secrets. For more information, see JSON structure of Secrets Manager secrets .
You can specify
MasterSecretArn
orSuperuserSecretArn
but not both. They represent the same superuser secret.- Link:
- Type:
The ARN of the secret that contains superuser credentials, if you use the `Alternating users rotation strategy <https
- Type:
//docs.aws.amazon.com/secretsmanager/latest/userguide/rotating-secrets_strategies.html#rotating-secrets-two-users>`_ . CloudFormation grants the execution role for the Lambda rotation function
GetSecretValue
permission to the secret in this property. For more information, see `Lambda rotation function execution role permissions for Secrets Manager <https
- superuser_secret_kms_key_arn
//docs.aws.amazon.com/secretsmanager/latest/userguide/rotating-secrets-required-permissions-function.html>`_ .
You can specify
MasterSecretKmsKeyArn
orSuperuserSecretKmsKeyArn
but not both. They represent the same superuser secret KMS key .- Link:
- Type:
The ARN of the KMS key that Secrets Manager used to encrypt the superuser secret, if you use the `alternating users strategy <https
- Type:
//docs.aws.amazon.com/secretsmanager/latest/userguide/rotating-secrets_strategies.html#rotating-secrets-two-users>`_ and the superuser secret is encrypted with a customer managed key. You don’t need to specify this property if the superuser secret is encrypted using the key
aws/secretsmanager
. CloudFormation grants the execution role for the Lambda rotation functionDecrypt
,DescribeKey
, andGenerateDataKey
permission to the key in this property. For more information, see `Lambda rotation function execution role permissions for Secrets Manager <https
- vpc_security_group_ids
A comma-separated list of security group IDs applied to the target database.
The template applies the same security groups as on the Lambda rotation function that is created as part of this stack.
- vpc_subnet_ids
A comma separated list of VPC subnet IDs of the target database network.
The Lambda rotation function is in the same subnet group.
RotationRulesProperty
- class CfnRotationSchedule.RotationRulesProperty(*, automatically_after_days=None, duration=None, schedule_expression=None)
Bases:
object
The rotation schedule and window.
We recommend you use
ScheduleExpression
to set a cron or rate expression for the schedule andDuration
to set the length of the rotation window.- Parameters:
automatically_after_days (
Union
[int
,float
,None
]) – The number of days between automatic scheduled rotations of the secret. You can use this value to check that your secret meets your compliance guidelines for how often secrets must be rotated. InDescribeSecret
andListSecrets
, this value is calculated from the rotation schedule after every successful rotation. InRotateSecret
, you can set the rotation schedule inRotationRules
withAutomaticallyAfterDays
orScheduleExpression
, but not both.duration (
Optional
[str
]) – The length of the rotation window in hours, for example3h
for a three hour window. Secrets Manager rotates your secret at any time during this window. The window must not extend into the next rotation window or the next UTC day. The window starts according to theScheduleExpression
. If you don’t specify aDuration
, for aScheduleExpression
in hours, the window automatically closes after one hour. For aScheduleExpression
in days, the window automatically closes at the end of the UTC day. For more information, including examples, see Schedule expressions in Secrets Manager rotation in the Secrets Manager Users Guide .schedule_expression (
Optional
[str
]) –A
cron()
orrate()
expression that defines the schedule for rotating your secret. Secrets Manager rotation schedules use UTC time zone. Secrets Manager rotates your secret any time during a rotation window. Secrets Managerrate()
expressions represent the interval in hours or days that you want to rotate your secret, for examplerate(12 hours)
orrate(10 days)
. You can rotate a secret as often as every four hours. If you use arate()
expression, the rotation window starts at midnight. For a rate in hours, the default rotation window closes after one hour. For a rate in days, the default rotation window closes at the end of the day. You can set theDuration
to change the rotation window. The rotation window must not extend into the next UTC day or into the next rotation window. You can use acron()
expression to create a rotation schedule that is more detailed than a rotation interval. For more information, including examples, see Schedule expressions in Secrets Manager rotation in the Secrets Manager Users Guide . For a cron expression that represents a schedule in hours, the default rotation window closes after one hour. For a cron expression that represents a schedule in days, the default rotation window closes at the end of the day. You can set theDuration
to change the rotation window. The rotation window must not extend into the next UTC day or into the next rotation window.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_secretsmanager as secretsmanager rotation_rules_property = secretsmanager.CfnRotationSchedule.RotationRulesProperty( automatically_after_days=123, duration="duration", schedule_expression="scheduleExpression" )
Attributes
- automatically_after_days
The number of days between automatic scheduled rotations of the secret.
You can use this value to check that your secret meets your compliance guidelines for how often secrets must be rotated.
In
DescribeSecret
andListSecrets
, this value is calculated from the rotation schedule after every successful rotation. InRotateSecret
, you can set the rotation schedule inRotationRules
withAutomaticallyAfterDays
orScheduleExpression
, but not both.
- duration
The length of the rotation window in hours, for example
3h
for a three hour window.Secrets Manager rotates your secret at any time during this window. The window must not extend into the next rotation window or the next UTC day. The window starts according to the
ScheduleExpression
. If you don’t specify aDuration
, for aScheduleExpression
in hours, the window automatically closes after one hour. For aScheduleExpression
in days, the window automatically closes at the end of the UTC day. For more information, including examples, see Schedule expressions in Secrets Manager rotation in the Secrets Manager Users Guide .
- schedule_expression
A
cron()
orrate()
expression that defines the schedule for rotating your secret.Secrets Manager rotation schedules use UTC time zone. Secrets Manager rotates your secret any time during a rotation window.
Secrets Manager
rate()
expressions represent the interval in hours or days that you want to rotate your secret, for examplerate(12 hours)
orrate(10 days)
. You can rotate a secret as often as every four hours. If you use arate()
expression, the rotation window starts at midnight. For a rate in hours, the default rotation window closes after one hour. For a rate in days, the default rotation window closes at the end of the day. You can set theDuration
to change the rotation window. The rotation window must not extend into the next UTC day or into the next rotation window.You can use a
cron()
expression to create a rotation schedule that is more detailed than a rotation interval. For more information, including examples, see Schedule expressions in Secrets Manager rotation in the Secrets Manager Users Guide . For a cron expression that represents a schedule in hours, the default rotation window closes after one hour. For a cron expression that represents a schedule in days, the default rotation window closes at the end of the day. You can set theDuration
to change the rotation window. The rotation window must not extend into the next UTC day or into the next rotation window.