Skip to content
v2.278.0

NatGatewayProps Struct ​

Properties for a NAT gateway.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_ec2 as ec2 } from 'aws-cdk-lib';
const natGatewayProps: ec2.NatGatewayProps = {
  eipAllocationIds: ['eipAllocationIds'],
  maxDrainDuration: cdk.Duration.minutes(30),
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk
from aws_cdk import aws_ec2 as ec2

nat_gateway_props = ec2.NatGatewayProps(
    eip_allocation_ids=["eipAllocationIds"],
    max_drain_duration=cdk.Duration.minutes(30)
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.*;
import software.amazon.awscdk.services.ec2.*;

NatGatewayProps natGatewayProps = NatGatewayProps.builder()
        .eipAllocationIds(List.of("eipAllocationIds"))
        .maxDrainDuration(Duration.minutes(30))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK;
using Amazon.CDK.AWS.EC2;

var natGatewayProps = new NatGatewayProps {
    EipAllocationIds = new [] { "eipAllocationIds" },
    MaxDrainDuration = Duration.Minutes(30)
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import cdk "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

natGatewayProps := &NatGatewayProps{
	EipAllocationIds: []*string{
		jsii.String("eipAllocationIds"),
	},
	MaxDrainDuration: cdk.Duration_Minutes(jsii.Number(30)),
}

Properties ​

eipAllocationIdsoptionalstring[]eip_allocation_idsoptionaltyping.List[str]eipAllocationIdsoptionalList<String>EipAllocationIdsoptionalstring[]EipAllocationIdsoptional*[]*string #
EIP allocation IDs for the NAT gateways.

Default: No fixed EIPs allocated for the NAT gateways

maxDrainDurationoptionalDurationmax_drain_durationoptionalDurationmaxDrainDurationoptionalDurationMaxDrainDurationoptionalDurationMaxDrainDurationoptionalDuration = Duration.seconds(350) #
Maximum amount of time to wait before forcibly releasing IP addresses if connections are still in progress.