我需要“检测” Aurora无服务器群集,以便在AWS Cloud Development Kit项目中使用它。必须从外部创建集群才能简化管理。
如何通过现有Aurora无服务器群集的ARN或名称将其导入到AWS CDK代码中(类似于Ec2.Vpc.fromLookup
CDK调用)?
答案 0 :(得分:0)
您可以使用静态的fromServerlessClusterAttributes
方法吗?
import * as cdk from '@aws-cdk/core';
import * as rds from '@aws-cdk/aws-rds';
export class AuroraServerlessStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
const myServerlessCluster = rds.ServerlessCluster.fromServerlessClusterAttributes(
this, "ExistingCluster", {
clusterIdentifier: "cluster-id-for-existing-cluster"
}
)
}
}