AWS Fundamentals Logo
AWS Fundamentals
AWS::EC2::NatGateway

EC2 NatGateway

Specifies a network address translation (NAT) gateway in the specified subnet. You can create either a public NAT gateway or a private NAT gateway. The default is a public NAT gateway. If you create a public NAT gateway, you must specify an elastic IP address. With a NAT gateway, instances in a private subnet can connect to the internet, other AWS services, or an on-premises network using the IP address of the NAT gateway. For more information, see [NAT gateways](https://docs.aws.amazon.com/...

Properties

12 configurable properties. Click a row to see details.

Filter:
PropertyTypeFlags
AllocationId
string
Create-only
AvailabilityMode
string
Create-only
AvailabilityZoneAddresses
Array<AvailabilityZoneAddress>
ConnectivityType
string
Create-only
MaxDrainDurationSeconds
integer
Write-only
PrivateIpAddress
string
Create-only
SecondaryAllocationIds
Array<string>
SecondaryPrivateIpAddressCount
integer
SecondaryPrivateIpAddresses
Array<string>
SubnetId
string
Create-only
Tags
Array<Tag>
VpcId
string
Create-only

Return Values

Values returned after the resource is created. Access these with Fn::GetAtt.

AttributeTypeDescription
AutoProvisionZonesstring-
AutoScalingIpsstring-
EniIdstring-
NatGatewayIdstring-
RouteTableIdstring-

Sample CloudFormation Template

A minimal template with required properties and common optional ones.

template.yaml
AWSTemplateFormatVersion: "2010-09-09"
Description: Sample template for AWS::EC2::NatGateway

Resources:
  MyResource:
    Type: AWS::EC2::NatGateway
    Properties:
      Tags:
        - Key: Environment
          Value: Production

Required IAM Permissions

Permissions CloudFormation needs in your IAM role to manage this resource.

create

ec2:CreateNatGatewayec2:DescribeNatGatewaysec2:CreateTags

delete

ec2:DeleteNatGatewayec2:DescribeNatGateways

list

ec2:DescribeNatGateways

read

ec2:DescribeNatGateways

update

ec2:DescribeNatGatewaysec2:CreateTagsec2:DeleteTagsec2:AssociateNatGatewayAddressec2:DisassociateNatGatewayAddressec2:AssignPrivateNatGatewayAddressec2:UnassignPrivateNatGatewayAddress

Get the EC2 Cheat Sheet

Everything you need to know about EC2 on one page. HD quality, print-friendly.

Download Free Infographic

Quick Facts

ServiceEC2
Properties17
Required0
TaggingSupported
Primary IDNatGatewayId

Supported Operations

CreateDeleteListReadUpdate

Immutable After Creation

These properties cannot be changed after the resource is created. Updating them triggers a replacement.

VpcIdSubnetIdConnectivityTypeAllocationIdPrivateIpAddressAvailabilityMode

External Links