亚马逊 Aurora DSQL 构造库
本单元中更高层次的构件的API是实验性的并正在积极开发中. 在今后任何版本中,它们都须作非背向相容的修改或去除。 这些是 不适用 语义版本 模型和断开的更改 在发行笔记中宣布. 这意味着虽然你可能使用它们,但可能需要更新 当更新到此软件包的更新版本时,您的源代码.
Amazon Aurora DSQL是一个无服务器的分布式关系数据库服务,优化用于交易工作量. 奥罗拉DSQL提供几乎无限的尺度,并不需要你管理基础设施. 活性活性高可用架构提供99.99%的单行区和99.99%的多行区可用率.
这个 @aws-cdk/aws-dsql-alpha 软件包包含用于设置 Aurora DSQL 集群的原始数据.
import * as dsql from '@aws-cdk/aws-dsql-alpha';
创建 Aurora DSQL 集群
要创建 Aurora DSQL 集群,请定义 Cluster数字 :
const cluster = new dsql.Cluster(this, 'Cluster', {
clusterName: 'my-dsql-cluster',
deletionProtection: true,
});
授予连接访问
您可以授予IAM主机连接集群的能力:
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