CreateNatGateway#

Description#

Creates a NAT gateway in the specified VPC. The NAT gateway provides VPC resources with access to the Internet.

A NAT gateway can be created only in a VPC that has an attached internet gateway (see AttachInternetGateway) and that does not already have a NAT gateway. Only one NAT gateway is supported per VPC.

If the AvailabilityZoneAddress parameter is not specified, the NAT gateway is created in automatic mode: the cloud allocates one Elastic IP address in each availability zone of the VPC. If the parameter is specified, the NAT gateway is created in manual mode and uses the provided Elastic IP addresses.

Request Parameters#

Required parameters#

  • VpcId — The ID of the VPC in which the NAT gateway is created.

    • Type: String

    • Required: Yes

Optional parameters#

  • AvailabilityMode — The availability mode of the NAT gateway.

    • Type: String

    • Valid values: regional

    • Required: No

  • AvailabilityZoneAddress.N — Elastic IP addresses assigned to the NAT gateway in availability zones, for manual mode.

    • Type: List of AvailabilityZoneAddress objects

    • Required: No

    • Constraints: If specified, the parameter must contain at least one item. An availability zone cannot be repeated

  • ConnectivityType — The connectivity type of the NAT gateway.

    • Type: String

    • Valid values: public

    • Required: No

  • TagSpecification.N — The tags assigned to the resource when it is created.

Response Elements#

  • natGateway — Information about the NAT gateway.

  • requestId — The request ID.

    • Type: String

Examples#

c2-ec2 CreateNatGateway VpcId <vpc_id>

c2-ec2 CreateNatGateway VpcId <vpc_id> AvailabilityZoneAddress.1.AvailabilityZone <az_name> AvailabilityZoneAddress.1.AllocationId.1 <eipalloc_id>