Nginx – Reverse Proxy from AWS VPC to Non-VPC EC2 instance

amazon ec2amazon-vpcamazon-web-servicesnginx

I have a VPC network inside AWS which is where all our new servers are. However, we have some old servers outside the VPC in the EC2 cloud network.

Currently we have a blog on http://blog.mydomain.com. However, we want to change it to respond on http://mydomain.com/blog/.

In order to do that we are going to use Nginx as a reverse proxy, but the Nginx server is inside the VPC. Is it possible to somehow (realiably and hopefully fast) access the non-VPC EC2 network from within the VPC?

Thanks

Best Answer

It seems like you may be assuming this is more complicated than it is.

You should be able to access anything on the Internet in general -- including and especially EC2 instances -- from within a VPC by using a NAT instance, which is likely how your VPC machines are already accessing AWS services like S3, SQS, SNS, etc., or external resources like downloading software updates.

http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_NAT_Instance.html

You don't need a tunnel, unless you need the traffic to be encrypted, which seems unlikely (since you could just use SSL) ... and if you do have a tunnel, you'll still need a NAT instance in order for your GRE traffic to make it out to the EC2 machine and the responses to come back... unless your Nginx machine already has an external public IP address of its own... in which case, you don't need anything, because you already have the fastest possible connectivity between the VPC machine and the EC2 machine.

Related Topic