A VPC contains a subnet whose route table has no route to an internet gateway. EC2 instances in this subnet have public IP addresses assigned. Can these instances reach the internet directly?
- Yes, because they have public IP addresses
- No, a route to an internet gateway in the subnet's route table is required regardless of whether instances have public IPs
- Yes, but only if a NAT gateway also exists somewhere in the VPC
- No, subnets can never have instances with public IP addresses
Correct answer: B. No, a route to an internet gateway in the subnet's route table is required regardless of whether instances have public IPs
Having a public IP address alone does not grant internet access; AWS only routes traffic to the internet gateway (IGW) if the subnet's route table contains an explicit route sending 0.0.0.0/0 (or the relevant IPv6 range) to that IGW. Option A is wrong because address assignment is separate from routing. Option C is wrong because a NAT gateway elsewhere in the VPC has no effect on this subnet's own route table; NAT gateways serve only the subnets whose route tables point at them, and even then only for outbound traffic from private instances. Option D is wrong because subnets can absolutely contain instances with public IPs — that is exactly what defines a typical public subnet once paired with an IGW route. The defining feature of a public subnet is the IGW route, not the presence of public IPs on its instances.
Source: AWS VPC docs: Route tables — routing traffic to the internet