Search code examples
amazon-web-servicesamazon-vpc

Can VPC with Internet Gateway attached have private subnets?


My understanding is - Yes. For a subnet to be public,

  1. The VPC to which it belongs to should have an Internet Gateway attached
  2. Route should exist in Subnet's route table to Internet Gateway

So this makes me believe that just attaching Internet Gateway doesn't make it's subnets public, and private subnets can exist in a VPC with an attached IGW.

Is my understanding correct?


Solution

  • Yes, your understanding is correct. That's exactly how you have both public and private subnets in the same VPC.