Created
July 31, 2022 05:35
-
-
Save leegilmorecode/1a16ce40cc65f760437eb27dbff3efa8 to your computer and use it in GitHub Desktop.
Example of setting up RDS Proxy with AWS CDK
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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