简体   繁体   中英

AWS ECS docker container RDS integration

I have two VPC's in the same account. VPC-A(has RDS installed), VPC-B has services installed through ECS EC2 deployment.

VPC-B has multiple subnets. Services deployed through ECS EC2 service couldn't integrate with RDS. It keeps getting the following error message("Is the server running on host "....")

Where as telnet on RDS database port from Ec2instance(E1) inc VPC-B subnet can connect to the database.

But, it couldn't start the server if the same services are installed through ECS. When manually trying to start the container it works(able to connect to the database).

I also set up a Peering connection between two VPC's but the connection problem exists only when the container is started through ECS EC2 deployment.

自动分配公共 IP

The dropdown for public IP has "Disabled" and no other options. Subnet's are public subnets.

Any help/thoughts will be highly helpful.

As per aws docs "awsvpc" launches in a private IP and to interact with external services nat gateway needs to be attached to subnet.

https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-networking.html#task-networking-considerations

The awsvpc network mode does not provide task ENIs with public IP addresses for tasks that use the EC2 launch type. To access the internet, tasks that use the EC2 launch type should be launched in a private subnet that is configured to use a NAT gateway.

"Auto assign public IP" mode is "Enabled" with "bridge" netowrking mode on on ECS EC2 launch.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM