Michael James Munar
03/17/2022, 1:58 AMconst cluster = new rds.ServerlessCluster(this, "CounterDBCluster", {
vpc,
defaultDatabaseName,
// Set the engine to Postgres
engine: rds.DatabaseClusterEngine.AURORA_POSTGRESQL,
parameterGroup: rds.ParameterGroup.fromParameterGroupName(
this,
"ParameterGroup",
"default.aurora-postgresql10"
),
// Optional, disable the instance from pausing after 5 minutes
scaling: { autoPause: cdk.Duration.seconds(0) },
});
What I've been trying to do is create 2 database outside, prod and dev and I've been trying to import it.
I've done
const vpc = ec2.Vpc.fromLookup(this, "VPC", {
vpcId: "vpc-xxxxxxx",
});
and
rds.DatabaseInstance.fromDatabaseInstanceAttributes
as well as
rds.DatabaseCluster.fromClusterAttributes
I couldn't seem to make anything workFrank
RDS
construct https://docs.serverless-stack.com/constructs/RDS#examplesFrank
Frank
Michael James Munar
03/17/2022, 2:04 AMMichael James Munar
03/17/2022, 2:04 AMFrank
if (stage === "dev" or "prod") {
cluster = new sst.RDS(...);
}
else {
cluster = import existing cluster created in "dev"
}
Michael James Munar
03/17/2022, 2:14 AMcluster = rds.DatabaseCluster.fromClusterAttributes(this, "Database", {
clusterIdentifier: "cluster-name",
instanceEndpointAddress: "cluster-endpoint",
engine: rds.DatabaseClusterEngine.AURORA_POSTGRESQL,
port: 5432,
});
and this is the way to import the cluster right?Frank
Michael James Munar
03/17/2022, 2:18 AM