Reputation: 11919
I have a database running inside AWS, region South America (Sao Paulo) that I could access with no problems from anywhere in the internet.
Then I wanted to create the same database on US East (North Virginia), but I wasn't able to access it from the internet. I compared creating a database on both regions to see the diferences and noticed the US East region doesn't list me any VPC to make it available to the internet.
I've been trying to create this VPC with subnet DB, etc, but no success! Anybody know what steps I need to do in order to make the database available to the internet?
Thanks!
Upvotes: 5
Views: 13431
Reputation: 1435
I had this same issue and I found the following alternative (instead of recreating my RDS instance and setting the "Publicly Accessible" setting to "Yes"). This involves setting up an SSH tunnel then connecting to the RDS instance via that tunnel:
Setup SSH Tunnel:
ssh -N -L 3306:RDS_HOST:3306 USER@EC2HOST -i SSH-KEY &
Connect to the RDS instance:
mysql -u rdsuser -p -h 127.0.0.1
Upvotes: 3
Reputation: 1269
First made sure that you have a DB-subnet group in my VPC with an associated VPC subnet in each of the availability regions, then
Create two subnets within the VPC one each in a different AZ for DB use (take a note of the Subnet IDs).
From RDS create a "Subnet Group" which you add the two subnets to one from each AZ so cover multi-az deployments. Now the "Choose a VPC" dropdown should be available when you create a new RDS instance.
for further info Go here please >>
ANSWER FOR YOUR SECOND QUESTION:
Q. Why there are only 251 IPs available when I created the subnet as 172.31.0.0/24?
A. When you create each subnet, you provide the VPC ID and the CIDR block you want for the subnet. After you create a subnet, you can't change its CIDR block. The subnet's CIDR block can be the same as the VPC's CIDR block (assuming you want only a single subnet in the VPC), or a subset of the VPC's CIDR block. If you create more than one subnet in a VPC, the subnets' CIDR blocks must not overlap. The smallest subnet (and VPC) you can create uses a /28 netmask (16 IP addresses), and the largest uses a /16 netmask (65,536 IP addresses).
Important
AWS reserves both the first four and the last IP address in each subnet's CIDR block. They're not available for use.
If you add more than one subnet to a VPC, they're set up in a star topology with a logical router in the middle. By default, you can create up to 20 subnets in a VPC. If you need more than 20 subnets, you can request more by going to 'Request to Increase Amazon VPC Limits'
for further info GO here please.
Upvotes: 5