Detect, troubleshoot & optimize AWS environments in real-time ->

Amazon Web Service (AWS)

Internet Gateway

An internet gateway (IGW) allows resources associated with public IP (IPv4 or IPv6 address) within your VPC to access the internet. Likewise, resources on the internet can initiate a connection to resources in your subnet using the public IPv4 address or IPv6 address.
The cost of using an Internet Gateway is determined by the amount of data processed through it, with no additional charges for creation or deletion of the Internet Gateway. The cost starts at $0.05 per GB of data processed and decreases as data processed increases.
Direct Cost


Indirect Cost
No items found.
Terraform Name
Internet Gateway
  • vpc_id - (Optional) The VPC ID to create in. See the aws_internet_gateway_attachment resource for an alternate way to attach an Internet Gateway to a VPC.
  • tags - (Optional) A map of tags to assign to the resource. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Associating resources with a
Internet Gateway
Resources do not "belong" to a
Internet Gateway
Rather, one or more Security Groups are associated to a resource.
Internet Gateway
via Terraform:
The following HCL creates an internet gateway with the tag Name my-igw

resource "aws_internet_gateway" "gw" {
 vpc_id =

 tags = {
   Name = "my-igw"

Internet Gateway
via CLI:

[--tag-specifications <value>]
[--dry-run | --no-dry-run]
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]
[--endpoint-url <value>]
[--output <value>]
[--query <value>]
[--profile <value>]
[--region <value>]
[--version <value>]
[--color <value>]
[--ca-bundle <value>]
[--cli-read-timeout <value>]
[--cli-connect-timeout <value>]
[--cli-binary-format <value>]


aws ec2 create-internet-gateway \
   --tag-specifications ResourceType=internet-gateway,Tags=[{Key=Name,Value=my-igw}]

Best Practices for
Internet Gateway

Categorized by Availability, Security & Compliance and Cost

Explore all the rules our platform covers
Related blog posts
All Resources