1
votes

I have an EC2 instance in one region, N.California. I have an RDS instance in EU/Ireland. I am not able to connect to the RDS instance from the EC2 instance, the connection times out. This tutorial by aws says that I would need to use the Public IP of the RDS instance in order to connect to it. But this public IP is not available on the AWS console, I'm not even sure if we're supposed to be using any other than RDS endpoints. We're also disallowed from adding a security group from one region to the security group of another.

I am really unsure about how to proceed.

1
You have to add an Elastic IP Addresses to your RDS instance, more detail there: docs.aws.amazon.com/AWSEC2/latest/UserGuide/…ar-ms
Odd, I was able to get around this, by placing my EC2 EIP in the RDS Instance security group for tcp connections on port 3306. It is more than happy now. Odd because the documentation explicitly indicates we must use the RDS IP address.user1658296
@Koffee wrong, you can't associate Elastic IPs with RDS instances.Mark B
@user1658296 that tutorial is wrong. You are just connecting to your RDS instance over the internet, the same as if you were connecting from your laptop. You just have to have "publicly accessible" enabled on the RDS server and the security group open to the appropriate IP addresses.Mark B
AWS tutorial is not wrong but for different scenario. That tutorial is for the custom VPC connected by internet gateways. AWS account comes with default VPC which has all the internet gateways connected and all the resources as public so you just need to adjust your security group forspecific protocol.hemc4

1 Answers

1
votes

I am answering my own question because my own solution worked, and it might be of use to someone else considering that the AWS tutorial is wrong.

To connect, add a custom tcp rule over port 3306 in the security group Ingress Rules for the RDS instance, with the EIP of your EC2 instance as the allowed host. Voila.