Show / Hide Table of Contents

Class ServerlessClusterProps

Properties for a new Aurora Serverless v1 Cluster.

Inheritance
object
ServerlessClusterProps
Implements
IServerlessClusterProps
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: Amazon.CDK.AWS.RDS
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class ServerlessClusterProps : IServerlessClusterProps
Syntax (vb)
Public Class ServerlessClusterProps Implements IServerlessClusterProps
Remarks

ExampleMetadata: infused

Examples
// Build a data source for AppSync to access the database.
            GraphqlApi api;
            // Create username and password secret for DB Cluster
            var secret = new DatabaseSecret(this, "AuroraSecret", new DatabaseSecretProps {
                Username = "clusteradmin"
            });

            // The VPC to place the cluster in
            var vpc = new Vpc(this, "AuroraVpc");

            // Create the serverless cluster, provide all values needed to customise the database.
            var cluster = new ServerlessCluster(this, "AuroraCluster", new ServerlessClusterProps {
                Engine = DatabaseClusterEngine.AURORA_MYSQL,
                Vpc = vpc,
                Credentials = new Dictionary<string, string> { { "username", "clusteradmin" } },
                ClusterIdentifier = "db-endpoint-test",
                DefaultDatabaseName = "demos"
            });
            var rdsDS = api.AddRdsDataSource("rds", cluster, secret, "demos");

            // Set up a resolver for an RDS query.
            rdsDS.CreateResolver("QueryGetDemosRdsResolver", new BaseResolverProps {
                TypeName = "Query",
                FieldName = "getDemosRds",
                RequestMappingTemplate = MappingTemplate.FromString(@"
                  {
                    ""version"": ""2018-05-29"",
                    ""statements"": [
                      ""SELECT * FROM demos""
                    ]
                  }
                  "),
                ResponseMappingTemplate = MappingTemplate.FromString(@"
                    $utils.toJson($utils.rds.toJsonObject($ctx.result)[0])
                  ")
            });

            // Set up a resolver for an RDS mutation.
            rdsDS.CreateResolver("MutationAddDemoRdsResolver", new BaseResolverProps {
                TypeName = "Mutation",
                FieldName = "addDemoRds",
                RequestMappingTemplate = MappingTemplate.FromString(@"
                  {
                    ""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)
                    }
                  }
                  "),
                ResponseMappingTemplate = MappingTemplate.FromString(@"
                    $utils.toJson($utils.rds.toJsonObject($ctx.result)[1][0])
                  ")
            });

Synopsis

Constructors

ServerlessClusterProps()

Properties for a new Aurora Serverless v1 Cluster.

Properties

BackupRetention

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

ClusterIdentifier

An optional identifier for the cluster.

CopyTagsToSnapshot

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

Credentials

Credentials for the administrative user.

DefaultDatabaseName

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

DeletionProtection

Indicates whether the DB cluster should have deletion protection enabled.

EnableDataApi

Whether to enable the Data API.

Engine

What kind of database to start.

ParameterGroup

Additional parameters to pass to the database engine.

RemovalPolicy

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

Scaling

Scaling configuration of an Aurora Serverless database cluster.

SecurityGroups

Security group.

StorageEncryptionKey

The KMS key for storage encryption.

SubnetGroup

Existing subnet group for the cluster.

Vpc

The VPC that this Aurora Serverless v1 Cluster has been created in.

VpcSubnets

Where to place the instances within the VPC.

Constructors

ServerlessClusterProps()

Properties for a new Aurora Serverless v1 Cluster.

public ServerlessClusterProps()
Remarks

ExampleMetadata: infused

Examples
// Build a data source for AppSync to access the database.
            GraphqlApi api;
            // Create username and password secret for DB Cluster
            var secret = new DatabaseSecret(this, "AuroraSecret", new DatabaseSecretProps {
                Username = "clusteradmin"
            });

            // The VPC to place the cluster in
            var vpc = new Vpc(this, "AuroraVpc");

            // Create the serverless cluster, provide all values needed to customise the database.
            var cluster = new ServerlessCluster(this, "AuroraCluster", new ServerlessClusterProps {
                Engine = DatabaseClusterEngine.AURORA_MYSQL,
                Vpc = vpc,
                Credentials = new Dictionary<string, string> { { "username", "clusteradmin" } },
                ClusterIdentifier = "db-endpoint-test",
                DefaultDatabaseName = "demos"
            });
            var rdsDS = api.AddRdsDataSource("rds", cluster, secret, "demos");

            // Set up a resolver for an RDS query.
            rdsDS.CreateResolver("QueryGetDemosRdsResolver", new BaseResolverProps {
                TypeName = "Query",
                FieldName = "getDemosRds",
                RequestMappingTemplate = MappingTemplate.FromString(@"
                  {
                    ""version"": ""2018-05-29"",
                    ""statements"": [
                      ""SELECT * FROM demos""
                    ]
                  }
                  "),
                ResponseMappingTemplate = MappingTemplate.FromString(@"
                    $utils.toJson($utils.rds.toJsonObject($ctx.result)[0])
                  ")
            });

            // Set up a resolver for an RDS mutation.
            rdsDS.CreateResolver("MutationAddDemoRdsResolver", new BaseResolverProps {
                TypeName = "Mutation",
                FieldName = "addDemoRds",
                RequestMappingTemplate = MappingTemplate.FromString(@"
                  {
                    ""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)
                    }
                  }
                  "),
                ResponseMappingTemplate = MappingTemplate.FromString(@"
                    $utils.toJson($utils.rds.toJsonObject($ctx.result)[1][0])
                  ")
            });

Properties

BackupRetention

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

public Duration? BackupRetention { get; set; }
Property Value

Duration

Remarks

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

Default: Duration.days(1)

ClusterIdentifier

An optional identifier for the cluster.

public string? ClusterIdentifier { get; set; }
Property Value

string

Remarks

Default: - A name is automatically generated.

CopyTagsToSnapshot

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

public bool? CopyTagsToSnapshot { get; set; }
Property Value

bool?

Remarks

Default: - true

Credentials

Credentials for the administrative user.

public Credentials? Credentials { get; set; }
Property Value

Credentials

Remarks

Default: - A username of 'admin' and SecretsManager-generated password

DefaultDatabaseName

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

public string? DefaultDatabaseName { get; set; }
Property Value

string

Remarks

Default: - Database is not created in cluster.

DeletionProtection

Indicates whether the DB cluster should have deletion protection enabled.

public bool? DeletionProtection { get; set; }
Property Value

bool?

Remarks

Default: - true if removalPolicy is RETAIN, false otherwise

EnableDataApi

Whether to enable the Data API.

public bool? EnableDataApi { get; set; }
Property Value

bool?

Remarks

Default: false

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

Engine

What kind of database to start.

public IClusterEngine Engine { get; set; }
Property Value

IClusterEngine

Remarks

ExampleMetadata: infused

ParameterGroup

Additional parameters to pass to the database engine.

public IParameterGroup? ParameterGroup { get; set; }
Property Value

IParameterGroup

Remarks

Default: - no parameter group.

RemovalPolicy

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

public RemovalPolicy? RemovalPolicy { get; set; }
Property Value

RemovalPolicy?

Remarks

Default: - RemovalPolicy.SNAPSHOT (remove the cluster and instances, but retain a snapshot of the data)

Scaling

Scaling configuration of an Aurora Serverless database cluster.

public IServerlessScalingOptions? Scaling { get; set; }
Property Value

IServerlessScalingOptions

Remarks

Default: - Serverless cluster is automatically paused after 5 minutes of being idle. minimum capacity: 2 ACU maximum capacity: 16 ACU

SecurityGroups

Security group.

public ISecurityGroup[]? SecurityGroups { get; set; }
Property Value

ISecurityGroup[]

Remarks

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.

StorageEncryptionKey

The KMS key for storage encryption.

public IKey? StorageEncryptionKey { get; set; }
Property Value

IKey

Remarks

Default: - the default master key will be used for storage encryption

SubnetGroup

Existing subnet group for the cluster.

public ISubnetGroup? SubnetGroup { get; set; }
Property Value

ISubnetGroup

Remarks

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

Vpc

The VPC that this Aurora Serverless v1 Cluster has been created in.

public IVpc? Vpc { get; set; }
Property Value

IVpc

Remarks

Default: - the default VPC in the account and region will be used

VpcSubnets

Where to place the instances within the VPC.

public ISubnetSelection? VpcSubnets { get; set; }
Property Value

ISubnetSelection

Remarks

If provided, the vpc property must also be specified.

Default: - the VPC default strategy if not specified.

Implements

IServerlessClusterProps
Back to top Generated by DocFX