Class NatInstanceProviderV2
java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.ec2.NatProvider
software.amazon.awscdk.services.ec2.NatInstanceProviderV2
- All Implemented Interfaces:
IConnectable,software.amazon.jsii.JsiiSerializable
@Generated(value="jsii-pacmak/1.120.0 (build 192dc88)",
date="2025-12-05T22:26:35.405Z")
@Stability(Stable)
public class NatInstanceProviderV2
extends NatProvider
implements IConnectable
Modern NAT provider which uses NAT Instances.
The instance uses Amazon Linux 2023 as the operating system.
Example:
NatInstanceProviderV2 natGatewayProvider = NatProvider.instanceV2(NatInstanceProps.builder()
.instanceType(new InstanceType("t3.small"))
.defaultAllowedTraffic(NatTrafficDirection.NONE)
.build());
Vpc vpc = Vpc.Builder.create(this, "Vpc").natGatewayProvider(natGatewayProvider).build();
SecurityGroup securityGroup = SecurityGroup.Builder.create(this, "SecurityGroup")
.vpc(vpc)
.allowAllOutbound(false)
.build();
securityGroup.addEgressRule(Peer.anyIpv4(), Port.tcp(443));
for (Object gatewayInstance : natGatewayProvider.getGatewayInstances()) {
gatewayInstance.addSecurityGroup(securityGroup);
}
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.amazon.awscdk.services.ec2.IConnectable
IConnectable.Jsii$Default, IConnectable.Jsii$Proxy -
Field Summary
FieldsModifier and TypeFieldDescriptionAmazon Linux 2023 NAT instance user data commands Enable iptables on the instance, enable persistent IP forwarding, configure NAT on instance. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedNatInstanceProviderV2(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedNatInstanceProviderV2(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionvoidconfigureNat(ConfigureNatOptions options) Called by the VPC to configure NAT.voidconfigureSubnet(PrivateSubnet subnet) Configures subnet with the gateway.Return list of gateways spawned by the provider.Manage the Security Groups associated with the NAT instances.Array of gateway instances spawned by the provider after internal configuration.The Security Group associated with the NAT instances.Methods inherited from class software.amazon.awscdk.services.ec2.NatProvider
gateway, gateway, instance, instanceV2Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
DEFAULT_USER_DATA_COMMANDS
Amazon Linux 2023 NAT instance user data commands Enable iptables on the instance, enable persistent IP forwarding, configure NAT on instance.- See Also:
-
-
Constructor Details
-
NatInstanceProviderV2
protected NatInstanceProviderV2(software.amazon.jsii.JsiiObjectRef objRef) -
NatInstanceProviderV2
protected NatInstanceProviderV2(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
NatInstanceProviderV2
- Parameters:
props- This parameter is required.
-
-
Method Details
-
configureNat
Called by the VPC to configure NAT.Don't call this directly, the VPC will call it automatically.
- Specified by:
configureNatin classNatProvider- Parameters:
options- This parameter is required.
-
configureSubnet
Configures subnet with the gateway.Don't call this directly, the VPC will call it automatically.
- Specified by:
configureSubnetin classNatProvider- Parameters:
subnet- This parameter is required.
-
getConfiguredGateways
Return list of gateways spawned by the provider.- Specified by:
getConfiguredGatewaysin classNatProvider
-
getConnections
Manage the Security Groups associated with the NAT instances.- Specified by:
getConnectionsin interfaceIConnectable
-
getGatewayInstances
Array of gateway instances spawned by the provider after internal configuration. -
getSecurityGroup
The Security Group associated with the NAT instances.
-