For the purposes of learning, I'm trying to setup a public/private VPC in AWS without using the wizard, and I'm trying to determine how AWS decides if a subnet is private/public.

For argument sake, let's say I have in my vpc 1 ig, 2 routing tables, 2 elbs, 4 instances, 4 subnets, and 2 availability zones.

    routepriv (default),
    { az1: [
      subnet1pub:  { range: "",    instances: [ instance1pub  ] },
      subnet1priv: { range: "",    instances: [ instance1priv ] }
    ] },
    { az2: [
      subnet2pub:  { range: "",  instances: [ instance2pub  ] },
      subnet2priv: { range: "",  instances: [ instance2priv ] }
    ] }

I have traffic coming from the greater internet to elbpub which then balances across my availability zones to instance1pub and instance2pub. I have some internal application (say a database or something such) on instance1priv and instance2priv which only instance1pub and instance2pub can access, and traffic to these is balanced via elbpriv.

When I try to set this up, I am told that I must attach my Internet-Facing ELB to a public subnet. So, how does AWS decide if a subnet is public or private?

And more specifically, I understand that private means it must go through a NAT and public means it goes through the IG, but how do I set up and/or link up my route tables/security groups to reflect this so that it lets me get public traffic into my public elb?


Only difference between the Private Subnets and Public Subnets is that, the latter one has connectivity to Internet Gateway established by the Subnet's Route table entry [ example : ig-abcdef12 ].

So in your example you would put the ELB in front of the Instances which are in Public Subnet. For the record, you can also create an Internal Load Balancer [ for scenarios like Web Servers in public subnet talking to App Servers fronted by an ELB fully insider the VPC - Private Subnet ]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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