class SecretRotation (construct)
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.SecretsManager.SecretRotation |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awssecretsmanager#SecretRotation |
Java | software.amazon.awscdk.services.secretsmanager.SecretRotation |
Python | aws_cdk.aws_secretsmanager.SecretRotation |
TypeScript (source) | aws-cdk-lib » aws_secretsmanager » SecretRotation |
Implements
IConstruct
, IDependable
Secret rotation for a service or database.
Example
declare const myUserSecret: secretsmanager.Secret;
declare const myMasterSecret: secretsmanager.Secret;
declare const myDatabase: ec2.IConnectable;
declare const myVpc: ec2.Vpc;
new secretsmanager.SecretRotation(this, 'SecretRotation', {
application: secretsmanager.SecretRotationApplication.MYSQL_ROTATION_MULTI_USER,
secret: myUserSecret, // The secret that will be rotated
masterSecret: myMasterSecret, // The secret used for the rotation
target: myDatabase,
vpc: myVpc,
});
Initializer
new SecretRotation(scope: Construct, id: string, props: SecretRotationProps)
Parameters
- scope
Construct
- id
string
- props
Secret
Rotation Props
Construct Props
Name | Type | Description |
---|---|---|
application | Secret | The serverless application for the rotation. |
secret | ISecret | The secret to rotate. It must be a JSON string with the following format:. |
target | IConnectable | The target service or database. |
vpc | IVpc | The VPC where the Lambda rotation function will run. |
automatically | Duration | Specifies the number of days after the previous rotation before Secrets Manager triggers the next automatic rotation. |
endpoint? | IInterface | The VPC interface endpoint to use for the Secrets Manager API. |
exclude | string | Characters which should not appear in the generated password. |
master | ISecret | The master secret for a multi user rotation scheme. |
rotate | boolean | Specifies whether to rotate the secret immediately or wait until the next scheduled rotation window. |
security | ISecurity | The security group for the Lambda rotation function. |
vpc | Subnet | The type of subnets in the VPC where the Lambda rotation function will run. |
application
Type:
Secret
The serverless application for the rotation.
secret
Type:
ISecret
The secret to rotate. It must be a JSON string with the following format:.
{
"engine": <required: database engine>,
"host": <required: instance host name>,
"username": <required: username>,
"password": <required: password>,
"dbname": <optional: database name>,
"port": <optional: if not specified, default port will be used>,
"masterarn": <required for multi user rotation: the arn of the master secret which will be used to create users/change passwords>
}
This is typically the case for a secret referenced from an AWS::SecretsManager::SecretTargetAttachment
or an ISecret
returned by the attach()
method of Secret
.
target
Type:
IConnectable
The target service or database.
vpc
Type:
IVpc
The VPC where the Lambda rotation function will run.
automaticallyAfter?
Type:
Duration
(optional, default: Duration.days(30))
Specifies the number of days after the previous rotation before Secrets Manager triggers the next automatic rotation.
endpoint?
Type:
IInterface
(optional, default: https://secretsmanager.
The VPC interface endpoint to use for the Secrets Manager API.
If you enable private DNS hostnames for your VPC private endpoint (the default), you don't need to specify an endpoint. The standard Secrets Manager DNS hostname the Secrets Manager CLI and SDKs use by default (https://secretsmanager.<region>.amazonaws.com) automatically resolves to your VPC endpoint.
excludeCharacters?
Type:
string
(optional, default: no additional characters are explicitly excluded)
Characters which should not appear in the generated password.
masterSecret?
Type:
ISecret
(optional, default: single user rotation scheme)
The master secret for a multi user rotation scheme.
rotateImmediatelyOnUpdate?
Type:
boolean
(optional, default: true)
Specifies whether to rotate the secret immediately or wait until the next scheduled rotation window.
securityGroup?
Type:
ISecurity
(optional, default: a new security group is created)
The security group for the Lambda rotation function.
vpcSubnets?
Type:
Subnet
(optional, default: the Vpc default strategy if not specified.)
The type of subnets in the VPC where the Lambda rotation function will run.
Properties
Name | Type | Description |
---|---|---|
node | Node | The tree node. |
node
Type:
Node
The tree node.
Methods
Name | Description |
---|---|
to | Returns a string representation of this construct. |
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.