aws-cdk-lib.aws_rds.ServerlessClusterFromSnapshot

class ServerlessClusterFromSnapshot (construct)

LanguageType name
.NETAmazon.CDK.AWS.RDS.ServerlessClusterFromSnapshot
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsrds#ServerlessClusterFromSnapshot
Javasoftware.amazon.awscdk.services.rds.ServerlessClusterFromSnapshot
Pythonaws_cdk.aws_rds.ServerlessClusterFromSnapshot
TypeScript (source)aws-cdk-lib » aws_rds » ServerlessClusterFromSnapshot

Implements IConstruct, IDependable, IResource, IServerlessCluster, IConnectable, ISecretAttachmentTarget

A Aurora Serverless Cluster restored from a snapshot.

Example

declare const vpc: ec2.Vpc;
new rds.ServerlessClusterFromSnapshot(this, 'Cluster', {
  engine: rds.DatabaseClusterEngine.AURORA_MYSQL,
  vpc,
  snapshotIdentifier: 'mySnapshot',
});

Initializer

new ServerlessClusterFromSnapshot(scope: Construct, id: string, props: ServerlessClusterFromSnapshotProps)

Parameters

  • scope Construct
  • id string
  • props ServerlessClusterFromSnapshotProps

Construct Props

NameTypeDescription
engineIClusterEngineWhat kind of database to start.
snapshotIdentifierstringThe identifier for the DB instance snapshot or DB cluster snapshot to restore from.
backupRetention?DurationThe number of days during which automatic DB snapshots are retained.
clusterIdentifier?stringAn optional identifier for the cluster.
copyTagsToSnapshot?booleanWhether to copy tags to the snapshot when a snapshot is created.
credentials?SnapshotCredentialsMaster user credentials.
defaultDatabaseName?stringName of a database which is automatically created inside the cluster.
deletionProtection?booleanIndicates whether the DB cluster should have deletion protection enabled.
enableDataApi?booleanWhether to enable the Data API.
parameterGroup?IParameterGroupAdditional parameters to pass to the database engine.
removalPolicy?RemovalPolicyThe removal policy to apply when the cluster and its instances are removed from the stack or replaced during an update.
scaling?ServerlessScalingOptionsScaling configuration of an Aurora Serverless database cluster.
securityGroups?ISecurityGroup[]Security group.
subnetGroup?ISubnetGroupExisting subnet group for the cluster.
vpc?IVpcThe VPC that this Aurora Serverless cluster has been created in.
vpcSubnets?SubnetSelectionWhere to place the instances within the VPC.

engine

Type: IClusterEngine

What kind of database to start.


snapshotIdentifier

Type: string

The identifier for the DB instance snapshot or DB cluster snapshot to restore from.

You can use either the name or the Amazon Resource Name (ARN) to specify a DB cluster snapshot. However, you can use only the ARN to specify a DB instance snapshot.


backupRetention?

Type: Duration (optional, default: Duration.days(1))

The number of days during which automatic DB snapshots are retained.

Automatic backup retention cannot be disabled on serverless clusters. Must be a value from 1 day to 35 days.


clusterIdentifier?

Type: string (optional, default: A name is automatically generated.)

An optional identifier for the cluster.


copyTagsToSnapshot?

Type: boolean (optional, default: true)

Whether to copy tags to the snapshot when a snapshot is created.


credentials?

Type: SnapshotCredentials (optional, default: The existing username and password from the snapshot will be used.)

Master user credentials.

Note - It is not possible to change the master username for a snapshot; however, it is possible to provide (or generate) a new password.


defaultDatabaseName?

Type: string (optional, default: Database is not created in cluster.)

Name of a database which is automatically created inside the cluster.


deletionProtection?

Type: boolean (optional, default: true if removalPolicy is RETAIN, false otherwise)

Indicates whether the DB cluster should have deletion protection enabled.


enableDataApi?

Type: boolean (optional, default: false)

Whether to enable the Data API.

See also: https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/data-api.html


parameterGroup?

Type: IParameterGroup (optional, default: no parameter group.)

Additional parameters to pass to the database engine.


removalPolicy?

Type: RemovalPolicy (optional, default: RemovalPolicy.SNAPSHOT (remove the cluster and instances, but retain a snapshot of the data))

The removal policy to apply when the cluster and its instances are removed from the stack or replaced during an update.


scaling?

Type: ServerlessScalingOptions (optional, default: Serverless cluster is automatically paused after 5 minutes of being idle. minimum capacity: 2 ACU maximum capacity: 16 ACU)

Scaling configuration of an Aurora Serverless database cluster.


securityGroups?

Type: ISecurityGroup[] (optional, default: a new security group is created if vpc was provided. If the vpc property was not provided, no VPC security groups will be associated with the DB cluster.)

Security group.


subnetGroup?

Type: ISubnetGroup (optional, default: a new subnet group is created if vpc was provided. If the vpc property was not provided, no subnet group will be associated with the DB cluster)

Existing subnet group for the cluster.


vpc?

Type: IVpc (optional, default: the default VPC in the account and region will be used)

The VPC that this Aurora Serverless cluster has been created in.


vpcSubnets?

Type: SubnetSelection (optional, default: the VPC default strategy if not specified.)

Where to place the instances within the VPC.

If provided, the vpc property must also be specified.

Properties

NameTypeDescription
clusterArnstringThe ARN of the cluster.
clusterEndpointEndpointThe endpoint to use for read/write operations.
clusterIdentifierstringIdentifier of the cluster.
clusterReadEndpointEndpointThe endpoint to use for read/write operations.
connectionsConnectionsAccess to the network connections.
envResourceEnvironmentThe environment this resource belongs to.
newCfnPropsCfnDBClusterProps
nodeNodeThe tree node.
securityGroupsISecurityGroup[]
stackStackThe stack in which this resource is defined.
enableDataApi?boolean
secret?ISecretThe secret attached to this cluster.

clusterArn

Type: string

The ARN of the cluster.


clusterEndpoint

Type: Endpoint

The endpoint to use for read/write operations.


clusterIdentifier

Type: string

Identifier of the cluster.


clusterReadEndpoint

Type: Endpoint

The endpoint to use for read/write operations.


connections

Type: Connections

Access to the network connections.


env

Type: ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.


newCfnProps

Type: CfnDBClusterProps


node

Type: Node

The tree node.


securityGroups

Type: ISecurityGroup[]


stack

Type: Stack

The stack in which this resource is defined.


enableDataApi?

Type: boolean (optional)


secret?

Type: ISecret (optional)

The secret attached to this cluster.

Methods

NameDescription
applyRemovalPolicy(policy)Apply the given removal policy to this resource.
asSecretAttachmentTarget()Renders the secret attachment target specifications.
grantDataApiAccess(grantee)Grant the given identity to access to the Data API, including read access to the secret attached to the cluster if present.
toString()Returns a string representation of this construct.

applyRemovalPolicy(policy)

public applyRemovalPolicy(policy: RemovalPolicy): void

Parameters

  • policy RemovalPolicy

Apply the given removal policy to this resource.

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


asSecretAttachmentTarget()

public asSecretAttachmentTarget(): SecretAttachmentTargetProps

Returns

  • SecretAttachmentTargetProps

Renders the secret attachment target specifications.


grantDataApiAccess(grantee)

public grantDataApiAccess(grantee: IGrantable): Grant

Parameters

  • grantee IGrantable — The principal to grant access to.

Returns

  • Grant

Grant the given identity to access to the Data API, including read access to the secret attached to the cluster if present.


toString()

public toString(): string

Returns

  • string

Returns a string representation of this construct.