How to Connect ECS Private IP to RDS Security Group Using CDK?
I need a private ip of ApplicationLoadBalancedFargateService (CDK Code).
I tried the following (Failed to resolve) :
const auroraSecurityGroup = new ec2.SecurityGroup(this, 'security-group', {
vpc,
allowAllOutbound: true,
description: 'Security Group of Aurora PostgreSQL',
securityGroupName: AURORA_SECURITY_GROUP_NAME
});
auroraSecurityGroup.addIngressRule(ec2.Peer.ipv4('my ecs private ip'), ec2.Port.tcp(DB_PORT), 'describe');
If you would like to allow specific ip address, you have to specify with cidr.
ec2.Peer.ipv4('1.2.3.4/32')
Allow the security group of the fargate service as a source to arurora seucirty group:
auroraSecurityGroup.connections.allowFrom(ecsService.service, Port.tcp(3306), 'Inbound');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.