NatGatewayProps

class aws_cdk.aws_ec2_alpha.NatGatewayProps(*, subnet, allocation_id=None, connectivity_type=None, max_drain_duration=None, nat_gateway_name=None, private_ip_address=None, secondary_allocation_ids=None, secondary_private_ip_address_count=None, secondary_private_ip_addresses=None, vpc=None)

Bases: NatGatewayOptions

(experimental) Properties to define a NAT gateway.

Parameters:
  • subnet (ISubnetV2) – (experimental) The subnet in which the NAT gateway is located.

  • allocation_id (Optional[str]) – (experimental) AllocationID of 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. Default: - attr.allocationID of a new Elastic IP created by default //TODO: ADD L2 for elastic ip

  • connectivity_type (Optional[NatConnectivityType]) – (experimental) Indicates whether the NAT gateway supports public or private connectivity. Default: NatConnectivityType.Public

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

  • nat_gateway_name (Optional[str]) – (experimental) The resource name of the NAT gateway. Default: - NATGW provisioned without any name

  • private_ip_address (Optional[str]) – (experimental) The private IPv4 address to assign to the NAT gateway. Default: - If you don’t provide an address, a private IPv4 address will be automatically assigned.

  • secondary_allocation_ids (Optional[Sequence[str]]) – (experimental) Secondary EIP allocation IDs. Default: - no secondary allocation IDs attached to NATGW

  • secondary_private_ip_address_count (Union[int, float, None]) – (experimental) The number of secondary private IPv4 addresses you want to assign to the NAT gateway. SecondaryPrivateIpAddressCount and SecondaryPrivateIpAddresses cannot be set at the same time. Default: - no secondary allocation IDs associated with NATGW

  • secondary_private_ip_addresses (Optional[Sequence[str]]) – (experimental) Secondary private IPv4 addresses. SecondaryPrivateIpAddressCount and SecondaryPrivateIpAddresses cannot be set at the same time. Default: - no secondary private IpAddresses associated with NATGW

  • vpc (Optional[IVpcV2]) – (experimental) The ID of the VPC in which the NAT gateway is located. Default: - no elastic ip associated, required in case of public connectivity if AllocationId is not defined

Stability:

experimental

ExampleMetadata:

infused

Example:

my_vpc = VpcV2(self, "Vpc")
route_table = RouteTable(self, "RouteTable",
    vpc=my_vpc
)
subnet = SubnetV2(self, "Subnet",
    vpc=my_vpc,
    availability_zone="eu-west-2a",
    ipv4_cidr_block=IpCidr("10.0.0.0/24"),
    subnet_type=SubnetType.PRIVATE_ISOLATED
)

natgw = NatGateway(self, "NatGW",
    subnet=subnet,
    vpc=my_vpc,
    connectivity_type=NatConnectivityType.PRIVATE,
    private_ip_address="10.0.0.42"
)
Route(self, "NatGwRoute",
    route_table=route_table,
    destination="0.0.0.0/0",
    target={"gateway": natgw}
)

Attributes

allocation_id

(experimental) AllocationID of 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.

Default:

  • attr.allocationID of a new Elastic IP created by default

//TODO: ADD L2 for elastic ip

Stability:

experimental

connectivity_type

(experimental) Indicates whether the NAT gateway supports public or private connectivity.

Default:

NatConnectivityType.Public

Stability:

experimental

max_drain_duration

(experimental) The maximum amount of time to wait before forcibly releasing the IP addresses if connections are still in progress.

Default:

350seconds

Stability:

experimental

nat_gateway_name

(experimental) The resource name of the NAT gateway.

Default:
  • NATGW provisioned without any name

Stability:

experimental

private_ip_address

(experimental) The private IPv4 address to assign to the NAT gateway.

Default:
  • If you don’t provide an address, a private IPv4 address will be automatically assigned.

Stability:

experimental

secondary_allocation_ids

(experimental) Secondary EIP allocation IDs.

Default:
  • no secondary allocation IDs attached to NATGW

See:

https://docs.aws.amazon.com/vpc/latest/userguide/vpc-nat-gateway.html#nat-gateway-creating

Stability:

experimental

secondary_private_ip_address_count

(experimental) The number of secondary private IPv4 addresses you want to assign to the NAT gateway.

SecondaryPrivateIpAddressCount and SecondaryPrivateIpAddresses cannot be set at the same time.

Default:
  • no secondary allocation IDs associated with NATGW

See:

https://docs.aws.amazon.com/vpc/latest/userguide/vpc-nat-gateway.html#nat-gateway-creating

Stability:

experimental

secondary_private_ip_addresses

(experimental) Secondary private IPv4 addresses.

SecondaryPrivateIpAddressCount and SecondaryPrivateIpAddresses cannot be set at the same time.

Default:
  • no secondary private IpAddresses associated with NATGW

See:

https://docs.aws.amazon.com/vpc/latest/userguide/vpc-nat-gateway.html#nat-gateway-creating

Stability:

experimental

subnet

(experimental) The subnet in which the NAT gateway is located.

Stability:

experimental

vpc

(experimental) The ID of the VPC in which the NAT gateway is located.

Default:
  • no elastic ip associated, required in case of public connectivity if AllocationId is not defined

Stability:

experimental