github.com/vtorhonen/terraform@v0.9.0-beta2.0.20170307220345-5d894e4ffda7/website/source/docs/providers/aws/r/nat_gateway.html.markdown (about) 1 --- 2 layout: "aws" 3 page_title: "AWS: aws_nat_gateway" 4 sidebar_current: "docs-aws-resource-nat-gateway" 5 description: |- 6 Provides a resource to create a VPC NAT Gateway. 7 --- 8 9 # aws\_nat\_gateway 10 11 Provides a resource to create a VPC NAT Gateway. 12 13 ## Example Usage 14 15 ``` 16 resource "aws_nat_gateway" "gw" { 17 allocation_id = "${aws_eip.nat.id}" 18 subnet_id = "${aws_subnet.public.id}" 19 } 20 ``` 21 22 ## Argument Reference 23 24 The following arguments are supported: 25 26 * `allocation_id` - (Required) The Allocation ID of the Elastic IP address for the gateway. 27 * `subnet_id` - (Required) The Subnet ID of the subnet in which to place the gateway. 28 29 -> **Note:** It's recommended to denote that the NAT Gateway depends on the Internet Gateway for the VPC in which the NAT Gateway's subnet is located. For example: 30 31 resource "aws_internet_gateway" "gw" { 32 vpc_id = "${aws_vpc.main.id}" 33 } 34 35 resource "aws_nat_gateway" "gw" { 36 //other arguments 37 38 depends_on = ["aws_internet_gateway.gw"] 39 } 40 41 42 ## Attributes Reference 43 44 The following attributes are exported: 45 46 * `id` - The ID of the NAT Gateway. 47 * `allocation_id` - The Allocation ID of the Elastic IP address for the gateway. 48 * `subnet_id` - The Subnet ID of the subnet in which the NAT gateway is placed. 49 * `network_interface_id` - The ENI ID of the network interface created by the NAT gateway. 50 * `private_ip` - The private IP address of the NAT Gateway. 51 * `public_ip` - The public IP address of the NAT Gateway. 52 53 ## Import 54 55 NAT Gateways can be imported using the `id`, e.g. 56 57 ``` 58 $ terraform import aws_nat_gateway.private_gw nat-05dba92075d71c408 59 ```