ServerlessClusterProps
- class aws_cdk.aws_rds.ServerlessClusterProps(*, engine, backup_retention=None, cluster_identifier=None, copy_tags_to_snapshot=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=None, vpc_subnets=None)
 Bases:
objectProperties for a new Aurora Serverless v1 Cluster.
- Parameters:
 engine (
IClusterEngine) – What kind of database to start.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.copy_tags_to_snapshot (
Optional[bool]) – Whether to copy tags to the snapshot when a snapshot is created. Default: - truecredentials (
Optional[Credentials]) – Credentials for the administrative user. Default: - A username of ‘admin’ and SecretsManager-generated passworddefault_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 ifvpcwas provided. If thevpcproperty was not provided, no VPC security groups will be associated with the DB cluster.storage_encryption_key (
Optional[IKey]) – The KMS key for storage encryption. Default: - the default master key will be used for storage encryptionsubnet_group (
Optional[ISubnetGroup]) – Existing subnet group for the cluster. Default: - a new subnet group is created ifvpcwas provided. If thevpcproperty was not provided, no subnet group will be associated with the DB clustervpc (
Optional[IVpc]) – The VPC that this Aurora Serverless v1 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, thevpcproperty must also be specified. Default: - the VPC default strategy if not specified.
- ExampleMetadata:
 infused
Example:
# Build a data source for AppSync to access the database. # api: appsync.GraphqlApi # Create username and password secret for DB Cluster secret = rds.DatabaseSecret(self, "AuroraSecret", username="clusteradmin" ) # The VPC to place the cluster in vpc = ec2.Vpc(self, "AuroraVpc") # Create the serverless cluster, provide all values needed to customise the database. cluster = rds.ServerlessCluster(self, "AuroraCluster", engine=rds.DatabaseClusterEngine.AURORA_MYSQL, vpc=vpc, credentials={"username": "clusteradmin"}, cluster_identifier="db-endpoint-test", default_database_name="demos" ) rds_dS = api.add_rds_data_source("rds", cluster, secret, "demos") # Set up a resolver for an RDS query. rds_dS.create_resolver("QueryGetDemosRdsResolver", type_name="Query", field_name="getDemosRds", request_mapping_template=appsync.MappingTemplate.from_string(""" { "version": "2018-05-29", "statements": [ "SELECT * FROM demos" ] } """), response_mapping_template=appsync.MappingTemplate.from_string(""" $utils.toJson($utils.rds.toJsonObject($ctx.result)[0]) """) ) # Set up a resolver for an RDS mutation. rds_dS.create_resolver("MutationAddDemoRdsResolver", type_name="Mutation", field_name="addDemoRds", request_mapping_template=appsync.MappingTemplate.from_string(""" { "version": "2018-05-29", "statements": [ "INSERT INTO demos VALUES (:id, :version)", "SELECT * WHERE id = :id" ], "variableMap": { ":id": $util.toJson($util.autoId()), ":version": $util.toJson($ctx.args.version) } } """), response_mapping_template=appsync.MappingTemplate.from_string(""" $utils.toJson($utils.rds.toJsonObject($ctx.result)[1][0]) """) )
Attributes
- backup_retention
 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
 An optional identifier for the cluster.
- Default:
 A name is automatically generated.
- copy_tags_to_snapshot
 Whether to copy tags to the snapshot when a snapshot is created.
- Default:
 true
- credentials
 Credentials for the administrative user.
- Default:
 A username of ‘admin’ and SecretsManager-generated password
- default_database_name
 Name of a database which is automatically created inside the cluster.
- Default:
 Database is not created in cluster.
- deletion_protection
 Indicates whether the DB cluster should have deletion protection enabled.
- Default:
 true if removalPolicy is RETAIN, false otherwise
- enable_data_api
 Whether to enable the Data API.
- engine
 What kind of database to start.
- parameter_group
 Additional parameters to pass to the database engine.
- Default:
 no parameter group.
- removal_policy
 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
 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
 Security group.
- Default:
 
a new security group is created if
vpcwas provided.
If the
vpcproperty was not provided, no VPC security groups will be associated with the DB cluster.
- storage_encryption_key
 The KMS key for storage encryption.
- Default:
 the default master key will be used for storage encryption
- subnet_group
 Existing subnet group for the cluster.
- Default:
 
a new subnet group is created if
vpcwas provided.
If the
vpcproperty was not provided, no subnet group will be associated with the DB cluster
- vpc
 The VPC that this Aurora Serverless v1 Cluster has been created in.
- Default:
 the default VPC in the account and region will be used
- vpc_subnets
 Where to place the instances within the VPC.
If provided, the
vpcproperty must also be specified.- Default:
 the VPC default strategy if not specified.