SecretRotationProps Struct
Construction properties for a SecretRotation.
| Source | aws-secretsmanager/lib/secret-rotation.ts |
|---|---|
| Type last changed |
Example
ts
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,
});
python
# my_user_secret: secretsmanager.Secret
# my_master_secret: secretsmanager.Secret
# my_database: ec2.IConnectable
# my_vpc: ec2.Vpc
secretsmanager.SecretRotation(self, "SecretRotation",
application=secretsmanager.SecretRotationApplication.MYSQL_ROTATION_MULTI_USER,
secret=my_user_secret, # The secret that will be rotated
master_secret=my_master_secret, # The secret used for the rotation
target=my_database,
vpc=my_vpc
)
java
Secret myUserSecret;
Secret myMasterSecret;
IConnectable myDatabase;
Vpc myVpc;
SecretRotation.Builder.create(this, "SecretRotation")
.application(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)
.build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
Secret myUserSecret;
Secret myMasterSecret;
IConnectable myDatabase;
Vpc myVpc;
new SecretRotation(this, "SecretRotation", new SecretRotationProps {
Application = 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
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var myUserSecret Secret
var myMasterSecret Secret
var myDatabase IConnectable
var myVpc Vpc
secretsmanager.NewSecretRotation(this, jsii.String("SecretRotation"), &SecretRotationProps{
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,
})
Properties
applicationSecretRotationApplicationapplicationSecretRotationApplicationapplicationSecretRotationApplicationApplicationSecretRotationApplicationApplicationSecretRotationApplication required #The serverless application for the rotation.
automaticallyAfteroptionalDurationautomatically_afteroptionalDurationautomaticallyAfteroptionalDurationAutomaticallyAfteroptionalDurationAutomaticallyAfteroptionalDuration = Duration.days(30) #Specifies the number of days after the previous rotation before Secrets Manager triggers the next automatic rotation.
endpointoptionalIInterfaceVpcEndpointendpointoptionalIInterfaceVpcEndpointendpointoptionalIInterfaceVpcEndpointEndpointoptionalIInterfaceVpcEndpointEndpointoptionalIInterfaceVpcEndpoint #The VPC interface endpoint to use for the Secrets Manager API.
Default: https://secretsmanager.<region>.amazonaws.com
notes
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.
excludeCharactersoptionalstringexclude_charactersoptionalstrexcludeCharactersoptionalStringExcludeCharactersoptionalstringExcludeCharactersoptional*string #Characters which should not appear in the generated password.
Default: no additional characters are explicitly excluded
masterSecretoptionalISecretmaster_secretoptionalISecretmasterSecretoptionalISecretMasterSecretoptionalISecretMasterSecretoptionalISecret #The master secret for a multi user rotation scheme.
Default: single user rotation scheme
rotateImmediatelyOnUpdateoptionalbooleanrotate_immediately_on_updateoptionalboolrotateImmediatelyOnUpdateoptionalBooleanRotateImmediatelyOnUpdateoptionalboolRotateImmediatelyOnUpdateoptional*bool = true #Specifies whether to rotate the secret immediately or wait until the next scheduled rotation window.
The secret to rotate. It must be a JSON string with the following format:.
notes
{
"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.
securityGroupoptionalISecurityGroupsecurity_groupoptionalISecurityGroupsecurityGroupoptionalISecurityGroupSecurityGroupoptionalISecurityGroupSecurityGroupoptionalISecurityGroup #The security group for the Lambda rotation function.
Default: a new security group is created
targetIConnectabletargetIConnectabletargetIConnectableTargetIConnectableTargetIConnectable required #The target service or database.
vpcSubnetsoptionalSubnetSelectionvpc_subnetsoptionalSubnetSelectionvpcSubnetsoptionalSubnetSelectionVpcSubnetsoptionalSubnetSelectionVpcSubnetsoptionalSubnetSelection #The type of subnets in the VPC where the Lambda rotation function will run.
Default: the Vpc default strategy if not specified.