In most cases, your VPC needs to have a connection with the public internet. In this case, you need to create an Internet Gateway (IGW) to attach to your VPC.
In the following example, an IGW is created and attached to vpc-0ca37d4650963adbb:
//create IGW, it returns IGW id as igw-01769bff334dcc035$ aws ec2 create-internet-gateway{ "InternetGateway": { "Attachments": [], "InternetGatewayId": "igw-01769bff334dcc035", "Tags": [] }} //attach igw-01769bff334dcc035 to vpc-0ca37d4650963adbb$ aws ec2 attach-internet-gateway --vpc-id vpc-0ca37d4650963adbb --internet-gateway-id igw-01769bff334dcc035
Once the IGW is attached, set a routing table (default gateway) for a subnet that points to the IGW. If a default gateway ...