Attaching an Internet Gateway to a VPC

You can attach an Internet gateway to a Virtual Private Cloud (VPC) in order to connect instances in one or more subnets directly to the Internet thanks to a route in their route table, security group rules and External IPs.

Attaching an Internet Gateway Using Cockpit v1

  1. Click VPC > Internet Gateways.

  2. Click the Internet gateway you want to attach to a VPC.
    The Internet gateway is selected.

  3. Click Attach .
    The ATTACH IGW-XXXXXX dialog box appears.

  4. Select a VPC from the VPC list.

  5. Click Attach to validate.
    The Internet gateway is attached to the selected VPC.

Linking an Internet Service Using Cockpit v2-beta

  1. Click inside the Internet Services dashboard to make checkboxes appear.

  2. Check the box of the Internet service you want to link.
    The Internet service is selected and an action menu appears.

  3. Click IconLink Link Internet Service.
    The LINK INTERNET SERVICE dialog box appears.

  4. Select a Net from the Net list.

  5. Click Link Internet Service to validate.
    The Internet service is linked to the Net.

Attaching an Internet Gateway Using AWS CLI

To attach an Internet gateway to a VPC, use the attach-internet-gateway command following this syntax:

Request sample
$ aws ec2 attach-internet-gateway \
    --profile YOUR_PROFILE \
    --internet-gateway-id igw-12345678 \
    --vpc-id vpc-12345678 \

This command contains the following attributes that you need to specify:

  • (optional) profile: The named profile you want to use, created when configuring AWS CLI. For more information, see Installing and Configuring AWS CLI.

  • internet-gateway-id: The ID of the Internet gateway.

  • vpc-id: The ID of the VPC.

  • endpoint: The endpoint corresponding to the Region you want to send the request to.

The Internet gateway is attached to the specified VPC.

Related Pages

Corresponding API Method

AWS™ and Amazon Web Services™ are trademarks of Amazon Technologies, Inc or its affiliates in the United States and/or other countries.