Procedure:
- Create VPC.
- Create subnets for the VPC, if not automatically done.
- For each subnet, edit subnet settings and ensure "Auto-assign public IPv4" is checked, or a public IP address won't be assigned to the instances.
By default a new VPC cannot be routed to the internet. This needs to be configured.
- Create an Internet Gateway.
- Attach the Internet Gateway to the VPC.
- Under subnets, select one of the new subnets and check which route table is in use.
- Navigate to Route Tables and select the relevant route table.
- Ensure that a route exists (or add a route if it does not) as follows:
- CIDR: 0.0.0.0/0
- Gateway/Router: the Internet Gateway we have created and attached to the VPC.
The following elements should be created or checked to ensure proper networking status:
- VPC
- Subnets with auto-assign of public IPv4
- Internet Gateway
- Internet Gateway attached to VPC
- Internet Gateway added to the routing table in use by the VPC/subnets