RegionalNatGatewayProviderProps

class aws_cdk.aws_ec2.RegionalNatGatewayProviderProps(*, allocation_id=None, availability_zone_addresses=None, eip=None, max_drain_duration=None)

Bases: object

Properties for a Regional NAT Gateway Provider.

Regional NAT Gateways provide automatic multi-AZ redundancy with a single gateway that scales across availability zones.

Parameters:
  • allocation_id (Optional[str]) – The allocation ID of the Elastic IP address to use for this NAT gateway. Cannot be specified together with eip. Ignored when availabilityZoneAddresses is specified. Default: - A new EIP is automatically allocated

  • availability_zone_addresses (Optional[Sequence[Union[AvailabilityZoneAddress, Dict[str, Any]]]]) – Specifies which Availability Zones you want the NAT gateway to support and the Elastic IP addresses to use in each AZ. When specified, allocationId and eip are ignored. This enables manual mode for Regional NAT Gateway where you control EIP allocation per AZ. In manual mode the gateway only serves the listed Availability Zones and does not expand to other zones automatically, so every Availability Zone that contains a private subnet routed through this gateway must be listed. When the zone names are known at synthesis time, a private subnet in an unlisted zone is rejected with an error. Entries that use availabilityZoneId or unresolved tokens cannot be checked and are assumed to be correct. Default: - Automatic mode: AWS manages AZ coverage and EIP allocation

  • eip (Optional[IEIPRef]) – Reference to an existing EIP to use for this NAT gateway. Cannot be specified together with allocationId. Ignored when availabilityZoneAddresses is specified. Default: - A new EIP is automatically allocated

  • max_drain_duration (Optional[Duration]) – Maximum amount of time to wait before forcibly releasing IP addresses if connections are still in progress. Default: Duration.seconds(350)

ExampleMetadata:

infused

Example:

eip = ec2.CfnEIP(self, "NatEip")

ec2.Vpc(self, "Vpc1",
    nat_gateway_provider=ec2.NatProvider.regional_gateway(
        eip=eip
    )
)

ec2.Vpc(self, "Vpc2",
    nat_gateway_provider=ec2.NatProvider.regional_gateway(
        allocation_id=eip.attr_allocation_id
    )
)

Attributes

allocation_id

The allocation ID of the Elastic IP address to use for this NAT gateway.

Cannot be specified together with eip. Ignored when availabilityZoneAddresses is specified.

Default:
  • A new EIP is automatically allocated

availability_zone_addresses

Specifies which Availability Zones you want the NAT gateway to support and the Elastic IP addresses to use in each AZ.

When specified, allocationId and eip are ignored. This enables manual mode for Regional NAT Gateway where you control EIP allocation per AZ.

In manual mode the gateway only serves the listed Availability Zones and does not expand to other zones automatically, so every Availability Zone that contains a private subnet routed through this gateway must be listed. When the zone names are known at synthesis time, a private subnet in an unlisted zone is rejected with an error. Entries that use availabilityZoneId or unresolved tokens cannot be checked and are assumed to be correct.

Default:
  • Automatic mode: AWS manages AZ coverage and EIP allocation

eip

Reference to an existing EIP to use for this NAT gateway.

Cannot be specified together with allocationId. Ignored when availabilityZoneAddresses is specified.

Default:
  • A new EIP is automatically allocated

max_drain_duration

Maximum amount of time to wait before forcibly releasing IP addresses if connections are still in progress.

Default:

Duration.seconds(350)