How does an instance (instance) in a VPC access the Internet after a VPC is created on the Amazon cloud? There are usually two ways of doing this:
- Assigning a public IP address directly
- Associating a VPC to an Internet gateway
- This way, the subnet where the instance resides, belongs to the public subnet
2. Via Nat Gateway or NAT instance
- In the routing table for each subnet, set the default route to Nat Gateway or NAT instance
- This way, the subnet where the instance resides, belongs to the private subnet
Different ways to access public and private subnets from internent using Elb (elastic load balancer)
For Elb that are accessible to the Internet, you can only associate to the public subnet, which is the default route to Internet gateway.
If you want to access Elb from internent and then access the private subnet, you need to add a layer of public subnets to the middle.
Internet gateway and Natgateway for AWS