ServerlessCluster

class aws_cdk.aws_rds.ServerlessCluster(scope, id, *, engine, vpc, 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, storage_encryption_key=None, subnet_group=None, vpc_subnets=None)

Bases: aws_cdk.core.Resource

(experimental) Create an Aurora Serverless Cluster.

Stability

experimental

Resource

AWS::RDS::DBCluster

Parameters
  • scope (Construct) –

  • id (str) –

  • engine (IClusterEngine) – (experimental) What kind of database to start.

  • vpc (IVpc) – (experimental) The VPC that this Aurora Serverless cluster has been created in.

  • backup_retention (Optional[Duration]) – (experimental) 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]) – (experimental) An optional identifier for the cluster. Default: - A name is automatically generated.

  • credentials (Optional[Credentials]) – (experimental) Credentials for the administrative user. Default: - A username of ‘admin’ and SecretsManager-generated password

  • default_database_name (Optional[str]) – (experimental) Name of a database which is automatically created inside the cluster. Default: - Database is not created in cluster.

  • deletion_protection (Optional[bool]) – (experimental) Indicates whether the DB cluster should have deletion protection enabled. Default: - true if removalPolicy is RETAIN, false otherwise

  • enable_data_api (Optional[bool]) – (experimental) Whether to enable the Data API. Default: false

  • parameter_group (Optional[IParameterGroup]) – (experimental) Additional parameters to pass to the database engine. Default: - no parameter group.

  • removal_policy (Optional[RemovalPolicy]) – (experimental) 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 (Optional[ServerlessScalingOptions]) – (experimental) 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 ACU

  • security_groups (Optional[List[ISecurityGroup]]) – (experimental) Security group. Default: - a new security group is created.

  • storage_encryption_key (Optional[IKey]) – (experimental) The KMS key for storage encryption. Default: - the default master key will be used for storage encryption

  • subnet_group (Optional[ISubnetGroup]) – (experimental) Existing subnet group for the cluster. Default: - a new subnet group will be created.

  • vpc_subnets (Optional[SubnetSelection]) – (experimental) Where to place the instances within the VPC. Default: - the VPC default strategy if not specified.

Stability

experimental

Methods

add_rotation_multi_user(id, *, secret, automatically_after=None, exclude_characters=None)

(experimental) Adds the multi user rotation to this cluster.

Parameters
  • id (str) –

  • secret (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: the arn of the master secret which will be used to create users/change passwords> }

  • automatically_after (Optional[Duration]) – Specifies the number of days after the previous rotation before Secrets Manager triggers the next automatic rotation. Default: - 30 days

  • exclude_characters (Optional[str]) – Specifies characters to not include in generated passwords. Default: ” %+~`#$&*()|[]{}:;<>?!’/

Stability

experimental

Return type

SecretRotation

add_rotation_single_user(*, automatically_after=None, exclude_characters=None)

(experimental) Adds the single user rotation of the master password to this cluster.

Parameters
  • automatically_after (Optional[Duration]) – Specifies the number of days after the previous rotation before Secrets Manager triggers the next automatic rotation. Default: - 30 days

  • exclude_characters (Optional[str]) – Specifies characters to not include in generated passwords. Default: ” %+~`#$&*()|[]{}:;<>?!’/

Stability

experimental

Return type

SecretRotation

as_secret_attachment_target()

(experimental) Renders the secret attachment target specifications.

Stability

experimental

Return type

SecretAttachmentTargetProps

grant_data_api_access(grantee)

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

Stability

experimental

Return type

Grant

to_string()

Returns a string representation of this construct.

Return type

str

Attributes

cluster_arn

(experimental) The ARN of the cluster.

Stability

experimental

Return type

str

cluster_endpoint

(experimental) The endpoint to use for read/write operations.

Stability

experimental

Return type

Endpoint

cluster_identifier

(experimental) Identifier of the cluster.

Stability

experimental

Return type

str

cluster_read_endpoint

(experimental) The endpoint to use for read/write operations.

Stability

experimental

Return type

Endpoint

connections

(experimental) Access to the network connections.

Stability

experimental

Return type

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.

Return type

ResourceEnvironment

node

The construct tree node associated with this construct.

Return type

ConstructNode

secret

(experimental) The secret attached to this cluster.

Stability

experimental

Return type

Optional[ISecret]

stack

The stack in which this resource is defined.

Return type

Stack

Static Methods

classmethod from_serverless_cluster_attributes(scope, id, *, cluster_identifier, cluster_endpoint_address=None, port=None, reader_endpoint_address=None, secret=None, security_groups=None)

(experimental) Import an existing DatabaseCluster from properties.

Parameters
  • scope (Construct) –

  • id (str) –

  • cluster_identifier (str) – (experimental) Identifier for the cluster.

  • cluster_endpoint_address (Optional[str]) – (experimental) Cluster endpoint address. Default: - no endpoint address

  • port (Union[int, float, None]) – (experimental) The database port. Default: - none

  • reader_endpoint_address (Optional[str]) – (experimental) Reader endpoint address. Default: - no reader address

  • secret (Optional[ISecret]) – (experimental) The secret attached to the database cluster. Default: - no secret

  • security_groups (Optional[List[ISecurityGroup]]) – (experimental) The security groups of the database cluster. Default: - no security groups

Stability

experimental

Return type

IServerlessCluster

classmethod is_construct(x)

Return whether the given object is a Construct.

Parameters

x (Any) –

Return type

bool