Skip to content

Resource: awsInternetGateway

Provides a resource to create a VPC Internet Gateway.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.internetGateway.InternetGateway(this, "gw", {
  tags: {
    Name: "main",
  },
  vpcId: "${aws_vpc.main.id}",
});

Argument Reference

The following arguments are supported:

  • vpcId - (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 defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

-> Note: It's recommended to denote that the AWS Instance or Elastic IP depends on the Internet Gateway. For example:

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsInternetGatewayGw = new aws.internetGateway.InternetGateway(
  this,
  "gw",
  {
    vpcId: "${aws_vpc.main.id}",
  }
);
new aws.instance.Instance(this, "foo", {
  depends_on: [`\${${awsInternetGatewayGw.fqn}}`],
});

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • id - The ID of the Internet Gateway.
  • arn - The ARN of the Internet Gateway.
  • ownerId - The ID of the AWS account that owns the internet gateway.
  • tagsAll - A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.

Timeouts

Configuration options:

  • create - (Default 20M)
  • update - (Default 20M)
  • delete - (Default 20M)

Import

Internet Gateways can be imported using the id, e.g.,

$ terraform import aws_internet_gateway.gw igw-c0a643a9