Skip to content

Instantly share code, notes, and snippets.

@leegilmorecode
Created July 31, 2022 05:35
Show Gist options
  • Save leegilmorecode/1a16ce40cc65f760437eb27dbff3efa8 to your computer and use it in GitHub Desktop.
Save leegilmorecode/1a16ce40cc65f760437eb27dbff3efa8 to your computer and use it in GitHub Desktop.
Example of setting up RDS Proxy with AWS CDK
const dbConnectionGroup: ec2.SecurityGroup = new ec2.SecurityGroup(
this,
"RdsProxyDBConnection",
{
vpc,
securityGroupName: "rds-proxy-sg",
}
);
dbConnectionGroup.addIngressRule(
dbConnectionGroup,
ec2.Port.tcp(5432),
"allow db connection"
);
const proxy: rds.DatabaseProxy = new rds.DatabaseProxy(
this,
"CustomerRdsProxy",
{
proxyTarget: rds.ProxyTarget.fromCluster(dbCluster),
secrets: [dbCluster.secret!],
securityGroups: [dbConnectionGroup],
dbProxyName: "orders-serverless-v2-rds-proxy",
debugLogging: true,
iamAuth: true,
vpc,
vpcSubnets: {
subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
},
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment