Sam Hulick
08/07/2021, 12:31 AMrds.SubnetGroup
: There are no 'Private' subnet groups in this VPC. Available types: Isolated,Public
it is NOT required to have NAT gateways. am I missing something? I have an existing setup in another account that works perfectly with a DB subnet group of private subnets, and there are no NAT gateways.
EDIT: does my RDS DB even need to be in a VPC? š¤ I mustāve configured it that way before for some good reason. can Lambdas not access the DB otherwise?Frank
Frank
Ross Coundon
08/07/2021, 6:35 AMRoss Coundon
08/07/2021, 6:40 AMSam Hulick
08/07/2021, 3:42 PMFrank
Sam Hulick
08/07/2021, 4:37 PMRoss Coundon
08/07/2021, 5:03 PMSam Hulick
08/07/2021, 5:05 PMAkos
08/09/2021, 11:36 AMconst vpc = new ec2.Vpc(this, 'VPC', {
cidr: '10.0.0.0/16',
// Use all AZs in a region
maxAzs: 99,
// For now we don't need NAT or DNS hostnames,
// if we add private/public subnets we'll need to change this
natGateways: 0,
enableDnsHostnames: false,
enableDnsSupport: false,
subnetConfiguration: [
{
cidrMask: 26,
name: 'database',
// No NAT Gateway (i.e. no internet access from this subnet)
subnetType: ec2.SubnetType.ISOLATED,
},
],
});
const cluster = new rds.ServerlessCluster(this, 'Database', {
engine: rds.DatabaseClusterEngine.AURORA_POSTGRESQL,
parameterGroup: rds.ParameterGroup.fromParameterGroupName(
this,
'ParameterGroup',
'default.aurora-postgresql10'
),
vpc,
vpcSubnets: {
subnetType: SubnetType.ISOLATED,
},
backupRetention: env.database.backupRetention,
removalPolicy: env.database.removalPolicy,
scaling: {
autoPause: env.database.scalingAutoPause,
minCapacity: env.database.scalingMinCapacity,
maxCapacity: env.database.scalingMaxCapacity,
},
defaultDatabaseName: this.databaseName,
enableDataApi: true,
});
(or at least I think we don't have a NAT gateway 𤣠)Sam Hulick
08/09/2021, 3:03 PMbindToCluster
- see my code here: https://github.com/aws/aws-cdk/issues/929#issuecomment-894580874Sam Hulick
08/09/2021, 3:04 PMengine
needed a whole object š¤ I think CDK needs work here. the documentation is so-so, and itās not always clear if you need a full object to define something, or just an enumSam Hulick
08/09/2021, 3:05 PMCfnDBCluster