1
votes

I can't connect to the internet. I

1) Setup an EC2 instance in a public subnet of my VPC and with a public IP

2) Enabled all inbound and outbound traffic for the security group (just to make sure things work and that this shouldn't be an issue).

3) Disabled destination/source checks on my public EC2 instance

4) My main route table (which is the one associated with my private subnet) routes traffic from 0.0.0.0/0 to my public EC2 instance

5) Launched an instance in my private subnet in the same VPC as my public instance (without an elastic or public ip)

6) I can successfully SSH to my public instance and run ping ietf.org

7) I can successfully SSH to my private instance from my public instance, BUT ping ietf.org times out

What else should I be doing?

2
This is a BAD question. YOU ARE NOT USING VPC NAT features. The correct topic should be : "Using my EC2 instance in Public subnet as NAT gateway for private subnet". You will easily find the correct solution for your issue. You need to do iptables setup inside public EC2 instance, no shortcut. - mootmoot
Thanks, that helped me a lot. I was pretty lost and found the answer quickly - tt_Gantz

2 Answers

1
votes

I made a mistake when setting up my EC2 instance. I was meant to set it up from an AMI of a machine with nat specific configurations on it. Otherwise I'd have to install them myselves.

An AMI type for this is amzn-ami-vpc-nat , I overlooked this line in the documentation

In hindsight I would just use the NAT gateway service AWS provides now. However it could be more expensive in the long run so compare the VPC pricing and the EC2 instance pricing

0
votes

Disabled destination/source checks - This is wrong, you should not disable this check on EC2, it's only for NAT. Please disable this and make sure your instance has a public IP or Elastic IP address.

-Pankaj