Secret rotation for a service or database.
import { SecretRotation } from 'aws-cdk-lib/aws-secretsmanager';Or use the module namespace:
import * as secretsmanager from 'aws-cdk-lib/aws-secretsmanager';
// secretsmanager.SecretRotationConfiguration passed to the constructor as SecretRotationProps.
applicationRequiredSecretRotationApplicationThe serverless application for the rotation.
secretRequiredISecretThe 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`.
targetRequiredIConnectableThe target service or database.
vpcRequiredIVpcThe VPC where the Lambda rotation function will run.
automaticallyAfterOptionalDurationSpecifies the number of days after the previous rotation before Secrets Manager triggers the next automatic rotation.
Default: Duration.days(30)
endpointOptionalIInterfaceVpcEndpointThe 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.
Default: https://secretsmanager.<region>.amazonaws.com
excludeCharactersOptionalstringCharacters which should not appear in the generated password.
Default: - no additional characters are explicitly excluded
masterSecretOptionalISecretThe master secret for a multi user rotation scheme.
Default: - single user rotation scheme
rotateImmediatelyOnUpdateOptionalbooleanSpecifies whether to rotate the secret immediately or wait until the next scheduled rotation window.
Default: true
securityGroupOptionalISecurityGroupThe security group for the Lambda rotation function.
Default: - a new security group is created
vpcSubnetsOptionalSubnetSelectionThe type of subnets in the VPC where the Lambda rotation function will run.
Default: - the Vpc default strategy if not specified.
Our bi-weekly newsletter teaches hands-on AWS fundamentals. No certification fluff - just practical knowledge.
Subscribe to Newsletteraws-secretsmanager