sparse-intern-71089
07/16/2021, 2:19 PMgreat-sunset-355
07/16/2021, 3:49 PMbillowy-army-68599
boundless-telephone-75738
07/19/2021, 6:43 AMconst dbSubnets = new aws.rds.SubnetGroup(
`unleash-iaac-private-subnets`,
{
subnetIds: vpc.privateSubnetIds,
}
);
export const unleashDb = new aws.rds.Instance(name, {
instanceClass: 'db.t3.micro',
dbSubnetGroupName: dbSubnets.id,
vpcSecurityGroupIds: [sg.id],
name: 'unleash',
allocatedStorage: 20,
maxAllocatedStorage: 100,
engine: 'postgres',
engineVersion: "13.3",
username: 'unleash',
publiclyAccessible: false,
skipFinalSnapshot: true,
deletionProtection: false,
password: randomPassword("database").result,
allowMajorVersionUpgrade: true
});
So, I might want to expand dbSubnet
to include the public subnet, and turn publiclyAccessible to true
?billowy-army-68599
boundless-telephone-75738
07/19/2021, 6:56 AMgreat-sunset-355
07/19/2021, 10:03 AMgreat-sunset-355
07/19/2021, 10:05 AMgreat-sunset-355
07/19/2021, 10:09 AM# on remote ec2
RDS_ENDPOINT=<instance>.<http://eu-central-1.rds.amazonaws.com:5432|eu-central-1.rds.amazonaws.com:5432>
REMOTE_PORT=5432
sudo socat TCP-LISTEN:${DEST_PORT},reuseaddr,fork TCP4:${RDS_ENDPOINT}
# on local machine:
$INSTANCE_ID=<cloud9 instanceID> # ID of cloud9 instance
REMOTE_PORT=5432 # port where cloud9 listens on
LOCAL_PORT=5432 # port on the local machine that is exposed
aws ssm start-session --target $INSTANCE_ID --document-name AWS-StartPortForwardingSession --parameters "{\"portNumber\":[\"${REMOTE_PORT}\"], \"localPortNumber\":[\"${LOCAL_PORT}\"]}"
# access RDS at <postgresql://localhost>:$LOCAL_PORT/db
boundless-telephone-75738
07/19/2021, 11:11 AM