We recommend new projects start with resources from the AWS provider.
aws-native.ec2.NatGateway
Explore with Pulumi AI
We recommend new projects start with resources from the AWS provider.
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 in the Amazon VPC User Guide.
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.
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 in the Amazon VPC User Guide.
Create NatGateway Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new NatGateway(name: string, args: NatGatewayArgs, opts?: CustomResourceOptions);
@overload
def NatGateway(resource_name: str,
args: NatGatewayArgs,
opts: Optional[ResourceOptions] = None)
@overload
def NatGateway(resource_name: str,
opts: Optional[ResourceOptions] = None,
subnet_id: Optional[str] = None,
allocation_id: Optional[str] = None,
connectivity_type: Optional[str] = None,
max_drain_duration_seconds: Optional[int] = None,
private_ip_address: Optional[str] = None,
secondary_allocation_ids: Optional[Sequence[str]] = None,
secondary_private_ip_address_count: Optional[int] = None,
secondary_private_ip_addresses: Optional[Sequence[str]] = None,
tags: Optional[Sequence[_root_inputs.TagArgs]] = None)
func NewNatGateway(ctx *Context, name string, args NatGatewayArgs, opts ...ResourceOption) (*NatGateway, error)
public NatGateway(string name, NatGatewayArgs args, CustomResourceOptions? opts = null)
public NatGateway(String name, NatGatewayArgs args)
public NatGateway(String name, NatGatewayArgs args, CustomResourceOptions options)
type: aws-native:ec2:NatGateway
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args NatGatewayArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args NatGatewayArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args NatGatewayArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args NatGatewayArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args NatGatewayArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
NatGateway Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The NatGateway resource accepts the following input properties:
- Subnet
Id string - The ID of the subnet in which the NAT gateway is located.
- Allocation
Id string - [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.
- Connectivity
Type string - Indicates whether the NAT gateway supports public or private connectivity. The default is public connectivity.
- Max
Drain intDuration Seconds - 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.
- Private
Ip stringAddress - 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 List<string>Ids - Secondary EIP allocation IDs. For more information, see Create a NAT gateway in the Amazon VPC User Guide.
- Secondary
Private intIp Address Count - [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 Virtual Private Cloud User Guide.
SecondaryPrivateIpAddressCount
andSecondaryPrivateIpAddresses
cannot be set at the same time. - Secondary
Private List<string>Ip Addresses - Secondary private IPv4 addresses. For more information about secondary addresses, see Create a NAT gateway in the Amazon Virtual Private Cloud User Guide.
SecondaryPrivateIpAddressCount
andSecondaryPrivateIpAddresses
cannot be set at the same time. - List<Pulumi.
Aws Native. Inputs. Tag> - The tags for the NAT gateway.
- Subnet
Id string - The ID of the subnet in which the NAT gateway is located.
- Allocation
Id string - [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.
- Connectivity
Type string - Indicates whether the NAT gateway supports public or private connectivity. The default is public connectivity.
- Max
Drain intDuration Seconds - 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.
- Private
Ip stringAddress - 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 []stringIds - Secondary EIP allocation IDs. For more information, see Create a NAT gateway in the Amazon VPC User Guide.
- Secondary
Private intIp Address Count - [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 Virtual Private Cloud User Guide.
SecondaryPrivateIpAddressCount
andSecondaryPrivateIpAddresses
cannot be set at the same time. - Secondary
Private []stringIp Addresses - Secondary private IPv4 addresses. For more information about secondary addresses, see Create a NAT gateway in the Amazon Virtual Private Cloud User Guide.
SecondaryPrivateIpAddressCount
andSecondaryPrivateIpAddresses
cannot be set at the same time. - Tag
Args - The tags for the NAT gateway.
- subnet
Id String - The ID of the subnet in which the NAT gateway is located.
- allocation
Id String - [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.
- connectivity
Type String - Indicates whether the NAT gateway supports public or private connectivity. The default is public connectivity.
- max
Drain IntegerDuration Seconds - 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.
- private
Ip StringAddress - 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 List<String>Ids - Secondary EIP allocation IDs. For more information, see Create a NAT gateway in the Amazon VPC User Guide.
- secondary
Private IntegerIp Address Count - [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 Virtual Private Cloud User Guide.
SecondaryPrivateIpAddressCount
andSecondaryPrivateIpAddresses
cannot be set at the same time. - secondary
Private List<String>Ip Addresses - Secondary private IPv4 addresses. For more information about secondary addresses, see Create a NAT gateway in the Amazon Virtual Private Cloud User Guide.
SecondaryPrivateIpAddressCount
andSecondaryPrivateIpAddresses
cannot be set at the same time. - List<Tag>
- The tags for the NAT gateway.
- subnet
Id string - The ID of the subnet in which the NAT gateway is located.
- allocation
Id string - [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.
- connectivity
Type string - Indicates whether the NAT gateway supports public or private connectivity. The default is public connectivity.
- max
Drain numberDuration Seconds - 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.
- private
Ip stringAddress - 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 string[]Ids - Secondary EIP allocation IDs. For more information, see Create a NAT gateway in the Amazon VPC User Guide.
- secondary
Private numberIp Address Count - [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 Virtual Private Cloud User Guide.
SecondaryPrivateIpAddressCount
andSecondaryPrivateIpAddresses
cannot be set at the same time. - secondary
Private string[]Ip Addresses - Secondary private IPv4 addresses. For more information about secondary addresses, see Create a NAT gateway in the Amazon Virtual Private Cloud User Guide.
SecondaryPrivateIpAddressCount
andSecondaryPrivateIpAddresses
cannot be set at the same time. - Tag[]
- The tags for the NAT gateway.
- subnet_
id str - The ID of the subnet in which the NAT gateway is located.
- allocation_
id str - [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.
- connectivity_
type str - Indicates whether the NAT gateway supports public or private connectivity. The default is public connectivity.
- max_
drain_ intduration_ seconds - 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.
- private_
ip_ straddress - 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_ Sequence[str]ids - Secondary EIP allocation IDs. For more information, see Create a NAT gateway in the Amazon VPC User Guide.
- secondary_
private_ intip_ address_ count - [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 Virtual Private Cloud User Guide.
SecondaryPrivateIpAddressCount
andSecondaryPrivateIpAddresses
cannot be set at the same time. - secondary_
private_ Sequence[str]ip_ addresses - Secondary private IPv4 addresses. For more information about secondary addresses, see Create a NAT gateway in the Amazon Virtual Private Cloud User Guide.
SecondaryPrivateIpAddressCount
andSecondaryPrivateIpAddresses
cannot be set at the same time. - Sequence[Tag
Args] - The tags for the NAT gateway.
- subnet
Id String - The ID of the subnet in which the NAT gateway is located.
- allocation
Id String - [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.
- connectivity
Type String - Indicates whether the NAT gateway supports public or private connectivity. The default is public connectivity.
- max
Drain NumberDuration Seconds - 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.
- private
Ip StringAddress - 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 List<String>Ids - Secondary EIP allocation IDs. For more information, see Create a NAT gateway in the Amazon VPC User Guide.
- secondary
Private NumberIp Address Count - [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 Virtual Private Cloud User Guide.
SecondaryPrivateIpAddressCount
andSecondaryPrivateIpAddresses
cannot be set at the same time. - secondary
Private List<String>Ip Addresses - Secondary private IPv4 addresses. For more information about secondary addresses, see Create a NAT gateway in the Amazon Virtual Private Cloud User Guide.
SecondaryPrivateIpAddressCount
andSecondaryPrivateIpAddresses
cannot be set at the same time. - List<Property Map>
- The tags for the NAT gateway.
Outputs
All input properties are implicitly available as output properties. Additionally, the NatGateway resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Nat
Gateway stringId - The ID of the NAT gateway.
- Id string
- The provider-assigned unique ID for this managed resource.
- Nat
Gateway stringId - The ID of the NAT gateway.
- id String
- The provider-assigned unique ID for this managed resource.
- nat
Gateway StringId - The ID of the NAT gateway.
- id string
- The provider-assigned unique ID for this managed resource.
- nat
Gateway stringId - The ID of the NAT gateway.
- id str
- The provider-assigned unique ID for this managed resource.
- nat_
gateway_ strid - The ID of the NAT gateway.
- id String
- The provider-assigned unique ID for this managed resource.
- nat
Gateway StringId - The ID of the NAT gateway.
Supporting Types
Tag, TagArgs
Package Details
- Repository
- AWS Native pulumi/pulumi-aws-native
- License
- Apache-2.0
We recommend new projects start with resources from the AWS provider.