如何在AWS CDK项目/堆栈中导入现有的Aurora无服务器集群



我需要"检测";Aurora Serverless集群,以便在AWS云开发工具包项目中使用它。为了便于管理,必须从外部创建集群。

如何将现有的Aurora Serverless集群按其ARN或名称导入AWS CDK代码(类似于Ec2.Vpc.fromLookupCDK调用(?

您能使用静态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"
}
)
}
}

最新更新