Work with internet gateways - Amazon Virtual Private Cloud
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Work with internet gateways

The following describes how to support internet access from a subnet in your VPC using an internet gateway. To remove internet access, you can detach the internet gateway from your VPC and then delete it.

Create an internet gateway

Use the following procedure to create an internet gateway.

To create an internet gateway
  1. Open the Amazon VPC console at https://console.amazonaws.cn/vpc/.

  2. In the navigation pane, choose Internet gateways.

  3. Choose Create internet gateway.

  4. (Optional) Enter a name for your internet gateway.

  5. (Optional) To add a tag, choose Add new tag and enter the tag key and value.

  6. Choose Create internet gateway.

  7. (Optional) To attach the internet gateway to a VPC now, choose Attach to a VPC from the banner at the top of the screen, select an available VPC, and then choose Attach internet gateway. Otherwise, you can attach your internet gateway to a VPC at another time.

Attach an internet gateway to a VPC

To use an internet gateway, you must attach it to a VPC.

To attach an internet gateway to a VPC
  1. Open the Amazon VPC console at https://console.amazonaws.cn/vpc/.

  2. In the navigation pane, choose Internet gateways.

  3. Select the check box for the internet gateway.

  4. Choose Actions, Attach to VPC.

  5. Select an available VPC.

  6. Choose Attach internet gateway.

Detach an internet gateway from your VPC

If you no longer need internet access for instances that you launch into a VPC, you can detach an internet gateway from a VPC. You can't detach an internet gateway if the VPC has resources with associated public IP addresses or Elastic IP addresses.

To detach an internet gateway
  1. Open the Amazon VPC console at https://console.amazonaws.cn/vpc/.

  2. In the navigation pane, choose Internet gateways.

  3. Select the check box for the internet gateway.

  4. Choose Actions, Detach from VPC.

  5. When prompted for confirmation, choose Detach internet gateway.

Delete an internet gateway

If you no longer need an internet gateway, you can delete it. You can't delete an internet gateway if it's still attached to a VPC.

To delete an internet gateway
  1. Open the Amazon VPC console at https://console.amazonaws.cn/vpc/.

  2. In the navigation pane, choose Internet gateways.

  3. Select the check box for the internet gateway.

  4. Choose Actions, Delete internet gateway.

  5. When prompted for confirmation, enter delete, and then choose Delete internet gateway.

API and command overview

You can perform the tasks described on this page using the command line or an API. For more information about the command line interfaces and a list of available API actions, see Working with Amazon VPC.

Create an internet gateway
Attach an internet gateway to a VPC
Describe an internet gateway
Detach an internet gateway from a VPC
Delete an internet gateway