thdxr
03/05/2021, 12:34 AMthis
isn't accepted as a constructFrank
new rds.DatabaseInstance(this, …)
? Can you provide more context?Frank
import * as cdk from "@aws-cdk/core";
import * as ec2 from "@aws-cdk/aws-ec2";
import * as rds from "@aws-cdk/aws-rds";
import * as sst from "@serverless-stack/resources";
class MySampleStack extends sst.Stack {
constructor(scope, id, props) {
super(scope, id, props);
// Create a VPC
const vpc = new ec2.Vpc(this, "Vpc", {
natGateways: 1,
});
// Create RDS
const instance = new rds.DatabaseInstance(this, 'Instance', {
engine: rds.DatabaseInstanceEngine.mysql({
version: rds.MysqlEngineVersion.VER_8_0_19,
}),
instanceType: ec2.InstanceType.of(ec2.InstanceClass.BURSTABLE3, ec2.InstanceSize.SMALL),
defaultDatabaseName: 'default',
vpc,
vpcSubnets: {
subnetType: ec2.SubnetType.PRIVATE
}
});
new cdk.CfnOutput(this, "DBAddress", {
value: instance.instanceEndpoint.socketAddress,
});
}
}
Not sure if it’s relevant to what are trying to put togetherthdxr
03/05/2021, 5:06 AMthdxr
03/05/2021, 5:07 AMthdxr
03/05/2021, 5:07 AMexport default class Stack extends sst.Stack {
constructor(scope: <http://sst.App|sst.App>, id: string, props?: sst.StackProps) {
super(scope, id, props)
const vpc = new ec2.Vpc(this, "nori")
const cluster = new rds.ServerlessCluster(this, "Postgres", {
vpc,
engine: rds.DatabaseClusterEngine.AURORA_POSTGRESQL,
defaultDatabaseName: "nori",
})
}
thdxr
03/05/2021, 5:08 AMlib/stack.ts:59:47 - error TS2345: Argument of type 'this' is not assignable to parameter of type 'Construct'.
Type 'Stack' is not assignable to type 'Construct'.
Property 'onValidate' is protected but type 'Construct' is not a class derived from 'Construct'.
59 const cluster = new rds.ServerlessCluster(this, "Postgres", {
~~~~
thdxr
03/05/2021, 5:09 AMFrank
thdxr
03/05/2021, 3:10 PMFrank
Frank