> **Experimental**
>
> `@aws-cdk/aws-ec2-alpha` is an [**experimental**](/stability) (alpha) package: its API may change in any release, without a major version bump.
# NatGatewayOptions

Options to define a NAT gateway.

- Stability: [Experimental](/cdk/api/stability.html)
- Source: [`lib/route.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0-alpha.0/packages/@aws-cdk/aws-ec2-alpha/lib/route.ts#L95)

## Example

```ts
const stack = new Stack();
const myVpc = new VpcV2(this, 'Vpc');
const routeTable = new RouteTable(this, 'RouteTable', {
  vpc: myVpc,
});
const subnet = new SubnetV2(this, 'Subnet', {
  vpc: myVpc,
  availabilityZone: 'eu-west-2a',
  ipv4CidrBlock: new IpCidr('10.0.0.0/24'),
  subnetType: SubnetType.PUBLIC });

myVpc.addInternetGateway();
myVpc.addNatGateway({
  subnet: subnet,
  connectivityType: NatConnectivityType.PUBLIC,
});
```

## Properties

- `allocationId`: string = attr.allocationID of a new Elastic IP created by default //TODO: ADD L2 for elastic ip — 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

- `connectivityType`: [NatConnectivityType](/cdk/api/v2/docs/@aws-cdk_aws-ec2-alpha.NatConnectivityType.html) = NatConnectivityType.Public — Indicates whether the NAT gateway supports public or private connectivity.

- `maxDrainDuration`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) = Duration.seconds(350) — The maximum amount of time to wait before forcibly releasing the IP addresses if connections are still in progress.

- `natGatewayName`: string = NATGW provisioned without any name — The resource name of the NAT gateway.

  **Default:** NATGW provisioned without any name

- `privateIpAddress`: string = If you don't provide an address, a private IPv4 address will be automatically assigned. — 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.

- `secondaryAllocationIds`: string[] = no secondary allocation IDs attached to NATGW — Secondary EIP allocation IDs.

  **Default:** no secondary allocation IDs attached to NATGW

- `secondaryPrivateIpAddressCount`: number = no secondary allocation IDs associated with NATGW — 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

- `secondaryPrivateIpAddresses`: string[] = no secondary private IpAddresses associated with NATGW — Secondary private IPv4 addresses.

  `SecondaryPrivateIpAddressCount` and `SecondaryPrivateIpAddresses` cannot be
  set at the same time.

  **Default:** no secondary private IpAddresses associated with NATGW

- `subnet`: [ISubnetV2](/cdk/api/v2/docs/@aws-cdk_aws-ec2-alpha.ISubnetV2.html) (required) — The subnet in which the NAT gateway is located.
