0

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?

Kshitij Kohli
  • 4,055
  • 4
  • 19
  • 27
  • 1
    VPC with [IGW](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_Internet_Gateway.html) can have both private and public subnets. VPC without IGW can only have private subnets. Related [answer](https://stackoverflow.com/questions/48830793/aws-vpc-identify-private-and-public-subnet/48831313#48831313). – jarmod Nov 11 '22 at 16:40

1 Answers1

3

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

jellycsc
  • 10,904
  • 2
  • 15
  • 32