ServerlessClusterFromSnapshot
- class aws_cdk.aws_rds.ServerlessClusterFromSnapshot(scope, id, *, engine, snapshot_identifier, backup_retention=None, cluster_identifier=None, credentials=None, default_database_name=None, deletion_protection=None, enable_data_api=None, parameter_group=None, removal_policy=None, scaling=None, security_groups=None, subnet_group=None, vpc=None, vpc_subnets=None)
Bases:
Resource
A Aurora Serverless Cluster restored from a snapshot.
- Resource:
AWS::RDS::DBCluster
- ExampleMetadata:
infused
Example:
# vpc: ec2.Vpc rds.ServerlessClusterFromSnapshot(self, "Cluster", engine=rds.DatabaseClusterEngine.AURORA_MYSQL, vpc=vpc, snapshot_identifier="mySnapshot" )
- Parameters:
scope (
Construct
)id (
str
)engine (
IClusterEngine
) – What kind of database to start.snapshot_identifier (
str
) – 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.backup_retention (
Optional
[Duration
]) – 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. Default: Duration.days(1)cluster_identifier (
Optional
[str
]) – An optional identifier for the cluster. Default: - A name is automatically generated.credentials (
Optional
[SnapshotCredentials
]) – 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. Default: - The existing username and password from the snapshot will be used.default_database_name (
Optional
[str
]) – Name of a database which is automatically created inside the cluster. Default: - Database is not created in cluster.deletion_protection (
Optional
[bool
]) – Indicates whether the DB cluster should have deletion protection enabled. Default: - true if removalPolicy is RETAIN, false otherwiseenable_data_api (
Optional
[bool
]) – Whether to enable the Data API. Default: falseparameter_group (
Optional
[IParameterGroup
]) – Additional parameters to pass to the database engine. Default: - no parameter group.removal_policy (
Optional
[RemovalPolicy
]) – The removal policy to apply when the cluster and its instances are removed from the stack or replaced during an update. Default: - RemovalPolicy.SNAPSHOT (remove the cluster and instances, but retain a snapshot of the data)scaling (
Union
[ServerlessScalingOptions
,Dict
[str
,Any
],None
]) – Scaling configuration of an Aurora Serverless database cluster. Default: - Serverless cluster is automatically paused after 5 minutes of being idle. minimum capacity: 2 ACU maximum capacity: 16 ACUsecurity_groups (
Optional
[Sequence
[ISecurityGroup
]]) – Security group. Default: - a new security group is created ifvpc
was provided. If thevpc
property was not provided, no VPC security groups will be associated with the DB cluster.subnet_group (
Optional
[ISubnetGroup
]) – Existing subnet group for the cluster. Default: - a new subnet group is created ifvpc
was provided. If thevpc
property was not provided, no subnet group will be associated with the DB clustervpc (
Optional
[IVpc
]) – The VPC that this Aurora Serverless cluster has been created in. Default: - the default VPC in the account and region will be usedvpc_subnets (
Union
[SubnetSelection
,Dict
[str
,Any
],None
]) – Where to place the instances within the VPC. If provided, thevpc
property must also be specified. Default: - the VPC default strategy if not specified.
Methods
- apply_removal_policy(policy)
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
).- Parameters:
policy (
RemovalPolicy
)- Return type:
None
- as_secret_attachment_target()
Renders the secret attachment target specifications.
- Return type:
- grant_data_api_access(grantee)
Grant the given identity to access to the Data API, including read access to the secret attached to the cluster if present.
- Parameters:
grantee (
IGrantable
) – The principal to grant access to.- Return type:
- to_string()
Returns a string representation of this construct.
- Return type:
str
Attributes
- cluster_arn
The ARN of the cluster.
- cluster_endpoint
The endpoint to use for read/write operations.
- cluster_identifier
Identifier of the cluster.
- cluster_read_endpoint
The endpoint to use for read/write operations.
- connections
Access to the network connections.
- env
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.
- node
The construct tree node associated with this construct.
- secret
The secret attached to this cluster.
- stack
The stack in which this resource is defined.
Static Methods
- classmethod is_construct(x)
Return whether the given object is a Construct.
- Parameters:
x (
Any
)- Return type:
bool
- classmethod is_resource(construct)
Check whether the given construct is a Resource.
- Parameters:
construct (
IConstruct
)- Return type:
bool