create_nat_gateway
async
¶
create_nat_gateway(
*,
config_overrides: Optional[AsyncEC2ClientConfig] = None,
availability_mode: Optional[AvailabilityMode] = None,
allocation_id: Optional[AllocationId] = None,
client_token: Optional[String] = None,
dry_run: Optional[Boolean] = None,
subnet_id: Optional[SubnetId] = None,
vpc_id: Optional[VpcId] = None,
availability_zone_addresses: Optional[AvailabilityZoneAddresses] = None,
tag_specifications: Optional[TagSpecificationList] = None,
connectivity_type: Optional[ConnectivityType] = None,
private_ip_address: Optional[String] = None,
secondary_allocation_ids: Optional[AllocationIdList] = None,
secondary_private_ip_addresses: Optional[IpList] = None,
secondary_private_ip_address_count: Optional[PrivateIpAddressCount] = None,
) -> CreateNatGatewayResult
Creates a NAT gateway in the specified subnet. This action creates a network interface in the specified subnet with a private IP address from the IP address range of the subnet. You can create either a public NAT gateway or a private NAT gateway.
With a public NAT gateway, internet-bound traffic from a private subnet can be routed to the NAT gateway, so that instances in a private subnet can connect to the internet.
With a private NAT gateway, private communication is routed across VPCs and on-premises networks through a transit gateway or virtual private gateway. Common use cases include running large workloads behind a small pool of allowlisted IPv4 addresses, preserving private IPv4 addresses, and communicating between overlapping networks.
For more information, see NAT gateways in the Amazon VPC User Guide.
When you create a public NAT gateway and assign it an EIP or secondary EIPs, the network border group of the EIPs must match the network border group of the Availability Zone (AZ) that the public NAT gateway is in. If it's not the same, the NAT gateway will fail to launch. You can see the network border group for the subnet's AZ by viewing the details of the subnet. Similarly, you can view the network border group of an EIP by viewing the details of the EIP address. For more information about network border groups and EIPs, see Allocate an Elastic IP address in the Amazon VPC User Guide.
Parameters:
-
availability_mode(Optional[AvailabilityMode], default:None) –Specifies whether to create a zonal (single-AZ) or regional (multi-AZ) NAT gateway. Defaults to
zonal.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.
For more information, see Regional NAT gateways for automatic multi-AZ expansion in the Amazon VPC User Guide.
-
allocation_id(Optional[AllocationId], default:None) –[Public NAT gateways only] The allocation ID of an Elastic IP address to associate with the NAT gateway. You cannot specify an Elastic IP address with a private NAT gateway. If the Elastic IP address is associated with another resource, you must first disassociate it.
-
client_token(Optional[String], default:None) –Unique, case-sensitive identifier that you provide to ensure the idempotency of the request. For more information, see Ensuring idempotency.
Constraint: Maximum 64 ASCII characters.
-
dry_run(Optional[Boolean], default:None) –Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is
DryRunOperation. Otherwise, it isUnauthorizedOperation. -
subnet_id(Optional[SubnetId], default:None) –The ID of the subnet in which to create the NAT gateway.
-
vpc_id(Optional[VpcId], default:None) –The ID of the VPC where you want to create a regional NAT gateway.
-
availability_zone_addresses(Optional[AvailabilityZoneAddresses], default:None) –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.
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.
For more information, see Regional NAT gateways for automatic multi-AZ expansion in the Amazon VPC User Guide.
-
tag_specifications(Optional[TagSpecificationList], default:None) –The tags to assign to the NAT gateway.
-
connectivity_type(Optional[ConnectivityType], default:None) –Indicates whether the NAT gateway supports public or private connectivity. The default is public connectivity.
-
private_ip_address(Optional[String], default:None) –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.
-
secondary_allocation_ids(Optional[AllocationIdList], default:None) –Secondary EIP allocation IDs. For more information, see Create a NAT gateway in the Amazon VPC User Guide.
-
secondary_private_ip_addresses(Optional[IpList], default:None) –Secondary private IPv4 addresses. For more information about secondary addresses, see Create a NAT gateway in the Amazon VPC User Guide.
-
secondary_private_ip_address_count(Optional[PrivateIpAddressCount], default:None) –[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 in the Amazon VPC User Guide.
Raises:
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To create a NAT gateway This example creates a NAT gateway in subnet subnet-1a2b3c4d and associates an Elastic IP address with the allocation ID eipalloc-37fc1a52 with the NAT gateway.
Source code in docs_src/capo_ec2/_services/async_ec2.py
10815 10816 10817 10818 10819 10820 10821 10822 10823 10824 10825 10826 10827 10828 10829 10830 10831 10832 10833 10834 10835 10836 10837 10838 10839 10840 10841 10842 10843 10844 10845 10846 10847 10848 10849 10850 10851 10852 10853 10854 10855 10856 10857 10858 10859 10860 10861 10862 10863 10864 10865 10866 10867 10868 10869 10870 10871 10872 10873 10874 10875 10876 10877 10878 10879 10880 10881 10882 10883 10884 10885 10886 10887 10888 10889 10890 10891 10892 10893 10894 10895 10896 10897 10898 10899 10900 10901 10902 10903 10904 10905 10906 10907 10908 10909 10910 10911 10912 10913 10914 10915 10916 10917 10918 10919 10920 10921 10922 10923 10924 10925 10926 10927 10928 10929 | |