AWS CLI with Internet Gateway
AWS CLI with Internet Gateway
- Create Internet Gateway
aws ec2 create-internet-gateway --query InternetGateway.InternetGatewayId --output text
- We will confirm the successful creation of Internet Gateway and use Internet gateway ID to perform the following steps.
- Then, we will check VPC to use VPC ID for the next step.
- After checking Internet Gateway and VPC, we execute attach internet gateway
aws ec2 attach-internet-gateway --vpc-id **VPC-ID** --internet-gateway-id **IGW ID**
- Similarly, create network resources like Route Table
aws ec2 create-route-table --vpc-id **VPC-ID** --query RouteTable.RouteTableId --output text
aws ec2 create-route --route-table-id **RTB ID** --destination-cidr-block 0.0.0.0/0 --gateway-id **IGW ID**
aws ec2 describe-route-tables --route-table-id **RTB-ID**
- Implement associate route table
aws ec2 associate-route-table --subnet-id **Subnet ID** --route-table-id **RTB ID**