interface NatGatewayProps
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.ec2.Alpha.NatGatewayProps |
Go | github.com/aws/aws-cdk-go/awsec2alpha/v2#NatGatewayProps |
Java | software.amazon.awscdk.services.ec2.alpha.NatGatewayProps |
Python | aws_cdk.aws_ec2_alpha.NatGatewayProps |
TypeScript (source) | @aws-cdk/aws-ec2-alpha ยป NatGatewayProps |
Properties to define a NAT gateway.
Example
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.PRIVATE_ISOLATED });
const natgw = new NatGateway(this, 'NatGW', {
subnet: subnet,
vpc: myVpc,
connectivityType: NatConnectivityType.PRIVATE,
privateIpAddress: '10.0.0.42',
});
new Route(this, 'NatGwRoute', {
routeTable,
destination: '0.0.0.0/0',
target: { gateway: natgw },
});
Properties
Name | Type | Description |
---|---|---|
subnet | ISubnet | The subnet in which the NAT gateway is located. |
allocation | string | AllocationID of Elastic IP address that's associated with the NAT gateway. |
connectivity | Nat | Indicates whether the NAT gateway supports public or private connectivity. |
max | Duration | The maximum amount of time to wait before forcibly releasing the IP addresses if connections are still in progress. |
nat | string | The resource name of the NAT gateway. |
private | string | The private IPv4 address to assign to the NAT gateway. |
secondary | string[] | Secondary EIP allocation IDs. |
secondary | number | The number of secondary private IPv4 addresses you want to assign to the NAT gateway. |
secondary | string[] | Secondary private IPv4 addresses. |
vpc? | IVpc | The ID of the VPC in which the NAT gateway is located. |
subnet
Type:
ISubnet
The subnet in which the NAT gateway is located.
allocationId?
Type:
string
(optional, default: 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.
connectivityType?
Type:
Nat
(optional, default: NatConnectivityType.Public)
Indicates whether the NAT gateway supports public or private connectivity.
maxDrainDuration?
Type:
Duration
(optional, default: 350seconds)
The maximum amount of time to wait before forcibly releasing the IP addresses if connections are still in progress.
natGatewayName?
Type:
string
(optional, default: NATGW provisioned without any name)
The resource name of the NAT gateway.
privateIpAddress?
Type:
string
(optional, default: 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.
secondaryAllocationIds?
Type:
string[]
(optional, default: no secondary allocation IDs attached to NATGW)
Secondary EIP allocation IDs.
secondaryPrivateIpAddressCount?
Type:
number
(optional, default: 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.
secondaryPrivateIpAddresses?
Type:
string[]
(optional, default: no secondary private IpAddresses associated with NATGW)
Secondary private IPv4 addresses.
SecondaryPrivateIpAddressCount
and SecondaryPrivateIpAddresses
cannot be
set at the same time.
vpc?
Type:
IVpc
(optional, default: no elastic ip associated, required in case of public connectivity if AllocationId
is not defined)
The ID of the VPC in which the NAT gateway is located.