1

I'm trying to hook up my private subnet postgres cluster to have internet access without being publicly accessible. My setup is as follows:

I have a VPC 10.1.0.0/16 with 4 subnets:

Postgres Subnet 10.1.2.0/24 with security group allow all ports dest. I have then attached NAT Gateway to my subnet and I allocated and associated an EIP to that NAT.

Then I created a route table that associates with my subnet that is:

  • 10.1.0.0/16 local
  • 0.0.0.0/0 My-NAT

I've checked that status of my NAT Gateway and EIP and everything is active and public.

After tunneling and connecting to my private ec2 postgres instance, I cannot ping my NAT Gateway -> Private IP Address 10.1.2.124/24 where my postgres server is 10.1.2.11/24.

I am at my wits end. If you need the cloudformation file to help debug, let me know and I will provide that.

Thanks!

  • I cannot ping my NAT Gateway -> Private IP Address 10.1.2.124/24 where my postgres server is 10.1.2.11/24. Please consider rewriting this section to explain what you are trying to do, from where. As it stands, it is very difficult to discern what's what and where. – Michael - sqlbot Mar 29 '16 at 10:05
1

Do you have an internet gateway attached to your VPC? Also, put the NAT gateway in a separate subnet.

This is the usual setup:

  • a public subnet with the NAT gateway. The public subnet routing table should redirect 0.0.0.0/0 to the internet gateway. Make sure your NAT gateway has an EIP.
  • a private subnet for your postgres instance. Make sure the private subnet routs 0.0.0.0/0 to the NAT gateway.
0

Amazon restricts icmp traffic by default, be sure you have that enabled on the security group if you want to be able to ping.

If you want to access the Internet via NAT you also have to disable the src/destination checks on the NAT instance.

  • I think he's using the AWS-managed NAT gateway, not an EC2 instance. So src/dest checking doesn't apply here. – Jeroen Jacobs Mar 29 '16 at 8:52

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.