Search code examples
amazon-web-servicesamazon-ec2aws-vpc

Amazon Web Services VPC public IP


Im working on building up my network which consists of a subnet in a VPC and three instances in the subnet. I have an elastic IP on one of the instances and no public ip or DNS on the others. For the purpose of the other instances reaching the internet for things like windows updates, is it possible to associate a public IP with the internet gateway on the VPC so all of the instances can reach the internet through one IP and for incoming traffic it would all be routed to Instance 1 only on a certain port. In our office now we have a server with multiple vlans all communicating to the internet with one public IP and i am trying to replicate this.

Thanks in advance for the help!


Solution

  • I did some searching before writing out the whole answer and found this write up that should help give you an idea on the distintion between an internet gateway and a Nat gateway. This will help with what you're trying to accomplish:

    AWS VPC - Internet Gateway vs. NAT

    As other have posted: using a NAT gateway is the best option here since instances with private ips will be able to connect to the internet.

    If you do have instances that are "public" ie with and EIP and others that should be private, I would recommend this architecture as laid out in the vpc guides on aws:

    https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Scenario2.html

    This will give you a good logical separation between public and private servers since they will be within their own subnet.