Detaching an Internet Gateway from a VPC

You can detach an Internet gateway from a Virtual Private Cloud (VPC) to remove its connection to the Internet.

This action does not remove routes using the Internet gateway as target. These routes are thus in the blackhole state.

Detaching an Internet Gateway Using Cockpit v1

Before you begin: Disassociate all External IPs that are associated with instances running in the VPC. For more information, see Disassociating an EIP from an Instance or a Network Interface.

  1. Click VPC > Internet Gateways.

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

  3. Click Detach .
    A confirmation dialog box appears.

  4. Click Detach to validate.
    The Internet gateway is detached from the selected VPC.

Unlinking an Internet Service Using Cockpit v2-beta

Before you begin: Unlink all public IPs that are linked with virtual machines (VMs) running in the Net. For more information, see Disassociating an EIP from an Instance or a Network Interface.

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

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

  3. Click IconUnlink Unlink Internet Service.
    A confirmation dialog box appears.

  4. Click Unlink Internet Service to validate.
    The Internet service is unlinked from the Net.

Detaching an Internet Gateway Using AWS CLI

Before you begin: Disassociate all External IPs from your running instances in the VPC. For more information, see Disassociating an EIP from an Instance or a Network Interface.

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

Request sample
$ aws ec2 detach-internet-gateway \
    --profile YOUR_PROFILE \
    --internet-gateway-id igw-12345678 \
    --vpc-id vpc-12345678 \
    --endpoint https://fcu.eu-west-2.outscale.com

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 detached from 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.