{
  "typeName" : "AWS::EC2::NatGateway",
  "description" : "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.\n 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/vpc/latest/userguide/vpc-nat-gateway.html) in the *Amazon VPC User Guide*.\n If you add a default route (``AWS::EC2::Route`` resource) that points to a NAT gateway, specify the NAT gateway ID for the route's ``NatGatewayId`` property.\n  When you associate an Elastic IP address or secondary Elastic IP address with a public NAT gateway, the network border group of the Elastic IP address must match the network border group of the Availability Zone (AZ) that the public NAT gateway is in. Otherwise, the NAT gateway fails to launch. You can see the network border group for the AZ by viewing the details of the subnet. Similarly, you can view the network border group for the Elastic IP address by viewing its details. For more information, see [Allocate an Elastic IP address](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-eips.html#allocate-eip) in the *Amazon VPC User Guide*.",
  "additionalProperties" : false,
  "properties" : {
    "SubnetId" : {
      "type" : "string",
      "description" : "The ID of the subnet in which the NAT gateway is located."
    },
    "NatGatewayId" : {
      "type" : "string",
      "description" : ""
    },
    "ConnectivityType" : {
      "type" : "string",
      "description" : "Indicates whether the NAT gateway supports public or private connectivity. The default is public connectivity."
    },
    "PrivateIpAddress" : {
      "type" : "string",
      "description" : "The private IPv4 address to assign to the NAT gateway. If you don't provide an address, a private IPv4 address will be automatically assigned."
    },
    "Tags" : {
      "type" : "array",
      "uniqueItems" : false,
      "insertionOrder" : false,
      "items" : {
        "$ref" : "#/definitions/Tag"
      },
      "description" : "The tags for the NAT gateway."
    },
    "AllocationId" : {
      "type" : "string",
      "description" : "[Public NAT gateway only] The allocation ID of the Elastic IP address that's associated with the NAT gateway. This property is required for a public NAT gateway and cannot be specified with a private NAT gateway."
    },
    "SecondaryAllocationIds" : {
      "type" : "array",
      "uniqueItems" : true,
      "insertionOrder" : true,
      "items" : {
        "type" : "string"
      },
      "description" : "Secondary EIP allocation IDs. For more information, see [Create a NAT gateway](https://docs.aws.amazon.com/vpc/latest/userguide/nat-gateway-working-with.html) in the *Amazon VPC User Guide*."
    },
    "SecondaryPrivateIpAddresses" : {
      "type" : "array",
      "uniqueItems" : true,
      "insertionOrder" : true,
      "items" : {
        "type" : "string"
      },
      "description" : "Secondary private IPv4 addresses. For more information about secondary addresses, see [Create a NAT gateway](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-nat-gateway.html#nat-gateway-creating) in the *Amazon Virtual Private Cloud User Guide*.\n ``SecondaryPrivateIpAddressCount`` and ``SecondaryPrivateIpAddresses`` cannot be set at the same time."
    },
    "SecondaryPrivateIpAddressCount" : {
      "type" : "integer",
      "minimum" : 1,
      "description" : "[Private NAT gateway only] The number of secondary private IPv4 addresses you want to assign to the NAT gateway. For more information about secondary addresses, see [Create a NAT gateway](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-nat-gateway.html#nat-gateway-creating) in the *Amazon Virtual Private Cloud User Guide*.\n ``SecondaryPrivateIpAddressCount`` and ``SecondaryPrivateIpAddresses`` cannot be set at the same time."
    },
    "MaxDrainDurationSeconds" : {
      "type" : "integer",
      "description" : "The maximum amount of time to wait (in seconds) before forcibly releasing the IP addresses if connections are still in progress. Default value is 350 seconds."
    },
    "VpcId" : {
      "type" : "string",
      "description" : "The ID of the VPC in which the NAT gateway is located."
    },
    "EniId" : {
      "type" : "string",
      "description" : ""
    },
    "RouteTableId" : {
      "type" : "string",
      "description" : ""
    },
    "AvailabilityMode" : {
      "type" : "string",
      "description" : "Indicates whether this is a zonal (single-AZ) or regional (multi-AZ) NAT gateway.\n A zonal NAT gateway is a NAT Gateway that provides redundancy and scalability within a single availability zone. A regional NAT gateway is a single NAT Gateway that works across multiple availability zones (AZs) in your VPC, providing redundancy, scalability and availability across all the AZs in a Region.\n For more information, see [Regional NAT gateways for automatic multi-AZ expansion](https://docs.aws.amazon.com/vpc/latest/userguide/nat-gateways-regional.html) in the *Amazon VPC User Guide*."
    },
    "AvailabilityZoneAddresses" : {
      "type" : "array",
      "uniqueItems" : true,
      "insertionOrder" : false,
      "items" : {
        "$ref" : "#/definitions/AvailabilityZoneAddress"
      },
      "description" : "For regional NAT gateways only: Specifies which Availability Zones you want the NAT gateway to support and the Elastic IP addresses (EIPs) to use in each AZ. The regional NAT gateway uses these EIPs to handle outbound NAT traffic from their respective AZs. If not specified, the NAT gateway will automatically expand to new AZs and associate EIPs upon detection of an elastic network interface. If you specify this parameter, auto-expansion is disabled and you must manually manage AZ coverage.\n A regional NAT gateway is a single NAT Gateway that works across multiple availability zones (AZs) in your VPC, providing redundancy, scalability and availability across all the AZs in a Region.\n For more information, see [Regional NAT gateways for automatic multi-AZ expansion](https://docs.aws.amazon.com/vpc/latest/userguide/nat-gateways-regional.html) in the *Amazon VPC User Guide*."
    },
    "AutoProvisionZones" : {
      "type" : "string",
      "description" : ""
    },
    "AutoScalingIps" : {
      "type" : "string",
      "description" : ""
    }
  },
  "definitions" : {
    "Tag" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Value" : {
          "type" : "string",
          "description" : "The tag value."
        },
        "Key" : {
          "type" : "string",
          "description" : "The tag key."
        }
      },
      "required" : [ "Value", "Key" ],
      "description" : "Specifies a tag. For more information, see [Resource tags](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-resource-tags.html)."
    },
    "AvailabilityZoneAddress" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "AvailabilityZone" : {
          "type" : "string",
          "description" : "For regional NAT gateways only: The Availability Zone where this specific NAT gateway configuration will be active. Each AZ in a regional NAT gateway has its own configuration to handle outbound NAT traffic from that AZ. \n A regional NAT gateway is a single NAT Gateway that works across multiple availability zones (AZs) in your VPC, providing redundancy, scalability and availability across all the AZs in a Region."
        },
        "AvailabilityZoneId" : {
          "type" : "string",
          "description" : "For regional NAT gateways only: The ID of the Availability Zone where this specific NAT gateway configuration will be active. Each AZ in a regional NAT gateway has its own configuration to handle outbound NAT traffic from that AZ. Use this instead of AvailabilityZone for consistent identification of AZs across AWS Regions. \n A regional NAT gateway is a single NAT Gateway that works across multiple availability zones (AZs) in your VPC, providing redundancy, scalability and availability across all the AZs in a Region."
        },
        "AllocationIds" : {
          "type" : "array",
          "uniqueItems" : true,
          "insertionOrder" : false,
          "items" : {
            "type" : "string"
          },
          "description" : "The allocation IDs of the Elastic IP addresses (EIPs) to be used for handling outbound NAT traffic in this specific Availability Zone."
        }
      },
      "required" : [ "AllocationIds" ],
      "description" : "For regional NAT gateways only: The configuration specifying which Elastic IP address (EIP) to use for handling outbound NAT traffic from a specific Availability Zone. \n A regional NAT gateway is a single NAT Gateway that works across multiple availability zones (AZs) in your VPC, providing redundancy, scalability and availability across all the AZs in a Region.\n For more information, see [Regional NAT gateways for automatic multi-AZ expansion](https://docs.aws.amazon.com/vpc/latest/userguide/nat-gateways-regional.html) in the *Amazon VPC User Guide*."
    }
  },
  "createOnlyProperties" : [ "/properties/VpcId", "/properties/SubnetId", "/properties/ConnectivityType", "/properties/AllocationId", "/properties/PrivateIpAddress", "/properties/AvailabilityMode" ],
  "primaryIdentifier" : [ "/properties/NatGatewayId" ],
  "readOnlyProperties" : [ "/properties/NatGatewayId", "/properties/EniId", "/properties/AutoProvisionZones", "/properties/AutoScalingIps", "/properties/RouteTableId" ],
  "writeOnlyProperties" : [ "/properties/MaxDrainDurationSeconds" ],
  "tagging" : {
    "taggable" : true,
    "tagOnCreate" : true,
    "tagUpdatable" : true,
    "cloudFormationSystemTags" : true,
    "tagProperty" : "/properties/Tags",
    "permissions" : [ "ec2:DeleteTags", "ec2:CreateTags" ]
  },
  "handlers" : {
    "create" : {
      "permissions" : [ "ec2:CreateNatGateway", "ec2:DescribeNatGateways", "ec2:CreateTags" ]
    },
    "delete" : {
      "permissions" : [ "ec2:DeleteNatGateway", "ec2:DescribeNatGateways" ]
    },
    "list" : {
      "permissions" : [ "ec2:DescribeNatGateways" ]
    },
    "read" : {
      "permissions" : [ "ec2:DescribeNatGateways" ]
    },
    "update" : {
      "permissions" : [ "ec2:DescribeNatGateways", "ec2:CreateTags", "ec2:DeleteTags", "ec2:AssociateNatGatewayAddress", "ec2:DisassociateNatGatewayAddress", "ec2:AssignPrivateNatGatewayAddress", "ec2:UnassignPrivateNatGatewayAddress" ],
      "timeoutInMinutes" : 90
    }
  }
}