Skip to content
v2.274.0

Amazon Aurora DSQL Construct Library ​

Version 2.274.0-alpha.0

Separate package

@aws-cdk/aws-dsql-alpha is not part of aws-cdk-lib — install it separately:

sh
npm install @aws-cdk/aws-dsql-alpha
pip install aws-cdk.aws-dsql-alpha

This module is experimental (alpha): its API may change in any release, without a major version bump.


cdk-constructs: Experimental

The APIs of higher level constructs in this module are experimental and under active development. They are subject to non-backward compatible changes or removal in any future version. These are not subject to the Semantic Versioning model and breaking changes will be announced in the release notes. This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package.


Amazon Aurora DSQL is a serverless, distributed relational database service optimized for transactional workloads. Aurora DSQL offers virtually unlimited scale and doesn't require you to manage infrastructure. The active-active highly available architecture provides 99.99% single-Region and 99.999% multi-Region availability.

The @aws-cdk/aws-dsql-alpha package contains primitives for setting up Aurora DSQL clusters.

ts
import * as dsql from '@aws-cdk/aws-dsql-alpha';
python
import aws_cdk.aws_dsql_alpha as dsql
java
import software.amazon.awscdk.services.dsql.alpha.*;
csharp
using Amazon.CDK.AWS.DSQL.Alpha;
go
import dsql "github.com/aws/aws-cdk-go/awscdkdsqlalpha"

Creating an Aurora DSQL Cluster ​

To create an Aurora DSQL cluster, define a Cluster:

ts
const cluster = new dsql.Cluster(this, 'Cluster', {
  clusterName: 'my-dsql-cluster',
  deletionProtection: true,
});
python
cluster = dsql.Cluster(self, "Cluster",
    cluster_name="my-dsql-cluster",
    deletion_protection=True
)
java
Cluster cluster = Cluster.Builder.create(this, "Cluster")
        .clusterName("my-dsql-cluster")
        .deletionProtection(true)
        .build();
csharp
var cluster = new Cluster(this, "Cluster", new ClusterProps {
    ClusterName = "my-dsql-cluster",
    DeletionProtection = true
});
go
cluster := dsql.NewCluster(this, jsii.String("Cluster"), &ClusterProps{
	ClusterName: jsii.String("my-dsql-cluster"),
	DeletionProtection: jsii.Boolean(true),
})

Granting Connect Access ​

You can grant IAM principals the ability to connect to the cluster:

ts
const role = new iam.Role(this, 'DBRole', { assumedBy: new iam.AccountPrincipal(this.account) });
const cluster = new dsql.Cluster(this, 'Cluster');

// Use one of the following statements to grant the role the necessary permissions
cluster.grantConnect(role); // Grant the role dsql:DbConnect
cluster.grantConnectAdmin(role); // Grant the role dsql:DbConnectAdmin
cluster.grant(role, 'dsql:DbConnect'); // Grant the role the specified actions to the cluster
python
role = iam.Role(self, "DBRole", assumed_by=iam.AccountPrincipal(self.account))
cluster = dsql.Cluster(self, "Cluster")

# Use one of the following statements to grant the role the necessary permissions
cluster.grant_connect(role) # Grant the role dsql:DbConnect
cluster.grant_connect_admin(role) # Grant the role dsql:DbConnectAdmin
cluster.grant(role, "dsql:DbConnect")
java
Role role = Role.Builder.create(this, "DBRole").assumedBy(new AccountPrincipal(this.account)).build();
Cluster cluster = new Cluster(this, "Cluster");

// Use one of the following statements to grant the role the necessary permissions
cluster.grantConnect(role); // Grant the role dsql:DbConnect
cluster.grantConnectAdmin(role); // Grant the role dsql:DbConnectAdmin
cluster.grant(role, "dsql:DbConnect");
csharp
var role = new Role(this, "DBRole", new RoleProps { AssumedBy = new AccountPrincipal(Account) });
var cluster = new Cluster(this, "Cluster");

// Use one of the following statements to grant the role the necessary permissions
cluster.GrantConnect(role); // Grant the role dsql:DbConnect
cluster.GrantConnectAdmin(role); // Grant the role dsql:DbConnectAdmin
cluster.Grant(role, "dsql:DbConnect");
go
role := iam.NewRole(this, jsii.String("DBRole"), &RoleProps{
	AssumedBy: iam.NewAccountPrincipal(this.Account),
})
cluster := dsql.NewCluster(this, jsii.String("Cluster"))

// Use one of the following statements to grant the role the necessary permissions
cluster.grantConnect(role) // Grant the role dsql:DbConnect
cluster.grantConnectAdmin(role) // Grant the role dsql:DbConnectAdmin
cluster.grant(role, jsii.String("dsql:DbConnect"))

Types ​

NameKindSummary
ClusterConstruct (L2)Create an Aurora DSQL cluster.
ClusterAttributesStructProperties that describe an existing Aurora DSQL cluster.
ClusterPropsStructProperties for a new Aurora DSQL cluster.
IClusterInterfaceRepresents an Aurora DSQL cluster.