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:
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.
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.
import * as dsql from '@aws-cdk/aws-dsql-alpha';
import aws_cdk.aws_dsql_alpha as dsql
import software.amazon.awscdk.services.dsql.alpha.*;
using Amazon.CDK.AWS.DSQL.Alpha;
import dsql "github.com/aws/aws-cdk-go/awscdkdsqlalpha"
Creating an Aurora DSQL Cluster
To create an Aurora DSQL cluster, define a Cluster:
const cluster = new dsql.Cluster(this, 'Cluster', {
clusterName: 'my-dsql-cluster',
deletionProtection: true,
});
cluster = dsql.Cluster(self, "Cluster",
cluster_name="my-dsql-cluster",
deletion_protection=True
)
Cluster cluster = Cluster.Builder.create(this, "Cluster")
.clusterName("my-dsql-cluster")
.deletionProtection(true)
.build();
var cluster = new Cluster(this, "Cluster", new ClusterProps {
ClusterName = "my-dsql-cluster",
DeletionProtection = true
});
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:
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
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")
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");
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");
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
| Name | Kind | Summary |
|---|---|---|
Cluster | Construct (L2) | Create an Aurora DSQL cluster. |
ClusterAttributes | Struct | Properties that describe an existing Aurora DSQL cluster. |
ClusterProps | Struct | Properties for a new Aurora DSQL cluster. |
ICluster | Interface | Represents an Aurora DSQL cluster. |