so I'm just learning about AWS VPC networking. From what I understand the main difference between a public subnet and private subnet is whether or not traffic in that subnet can be routed to the Internet Gateway (through route table rules).
However, this doesn't seem to be the only difference between the two. I notice public subnet would always have auto-assign public IP address
enabled, while private subnets would have it disabled.
So as a thought experiment I wonder what would happen if I disable the auto-assign feature in a public subnet, or enable it in a private subnet?
I can kind of guess that probably nothing would happen if I enable it in a private subnet because no traffic can be routed to the Internet Gateway anyway. So the auto-assigned IP addresses would simply go to waste.
But what about the first scenario? If I disable auto-assign in the public subnet, would the traffic still be able to be routed to the Internet Gateway and eventually to the Internet? Can I just create a NAT in that public subnet and route all Internet traffic to the NAT, so that we don't need to assign public IP to all public instances? I know we can just move those instances to the private subnet and route them to NAT, but I'm just curious if we have to assign individual IP addresses to all instances in the public subnet, because that seems a bit unnecessary to me.