Create Internet Gateway

AWS CLI with Internet Gateway

  1. Create Internet Gateway
aws ec2 create-internet-gateway --query InternetGateway.InternetGatewayId --output text

AWS CLI

Internet Gateway allows resources in the VPC to communicate with the internet. This is a necessary component for public-facing applications.

  1. Confirm Internet Gateway

We will confirm that the Internet Gateway has been created successfully and use the Internet Gateway ID for the next steps.

AWS CLI

Confirming the Internet Gateway is an important step before proceeding to the next steps. Save the Internet Gateway ID for the following steps.

  1. Check VPC

We will check the VPC to use the VPC ID for the next step.

AWS CLI

Save the VPC ID for the following steps.

  1. Attach Internet Gateway

After checking the Internet Gateway and VPC, we perform attach internet gateway by:

aws ec2 attach-internet-gateway --vpc-id <VPC-ID> --internet-gateway-id <IGW-ID>

AWS CLI

We need to use the correct VPC ID and Internet Gateway ID to attach successfully.