Class CfnNatGateway
- All Implemented Interfaces:
IInspectable,INatGatewayRef,IEnvironmentAware,ITaggable,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
You can create either a public NAT gateway or a private NAT gateway. The default is a public NAT gateway. If you create a public NAT gateway, you must specify an elastic IP address.
With a NAT gateway, instances in a private subnet can connect to the internet, other AWS services, or an on-premises network using the IP address of the NAT gateway. For more information, see NAT gateways in the Amazon VPC User Guide .
If you add a default route ( AWS::EC2::Route resource) that points to a NAT gateway, specify the NAT gateway ID for the route's NatGatewayId property.
When you associate an Elastic IP address or secondary Elastic IP address with a public NAT gateway, the network border group of the Elastic IP address must match the network border group of the Availability Zone (AZ) that the public NAT gateway is in. Otherwise, the NAT gateway fails to launch. You can see the network border group for the AZ by viewing the details of the subnet. Similarly, you can view the network border group for the Elastic IP address by viewing its details. For more information, see Allocate an Elastic IP address in the Amazon VPC User Guide .
Example:
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.ec2.*;
CfnNatGateway cfnNatGateway = CfnNatGateway.Builder.create(this, "MyCfnNatGateway")
.allocationId("allocationId")
.availabilityMode("availabilityMode")
.availabilityZoneAddresses(List.of(AvailabilityZoneAddressProperty.builder()
.allocationIds(List.of("allocationIds"))
// the properties below are optional
.availabilityZone("availabilityZone")
.availabilityZoneId("availabilityZoneId")
.build()))
.connectivityType("connectivityType")
.maxDrainDurationSeconds(123)
.privateIpAddress("privateIpAddress")
.secondaryAllocationIds(List.of("secondaryAllocationIds"))
.secondaryPrivateIpAddressCount(123)
.secondaryPrivateIpAddresses(List.of("secondaryPrivateIpAddresses"))
.subnetId("subnetId")
.tags(List.of(CfnTag.builder()
.key("key")
.value("value")
.build()))
.vpcId("vpcId")
.build();
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceFor regional NAT gateways only: The configuration specifying which Elastic IP address (EIP) to use for handling outbound NAT traffic from a specific Availability Zone.static final classA fluent builder forCfnNatGateway.Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.interfaces.ec2.INatGatewayRef
INatGatewayRef.Jsii$Default, INatGatewayRef.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.ITaggable
ITaggable.Jsii$Default, ITaggable.Jsii$Proxy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe CloudFormation resource type name for this resource class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCfnNatGateway(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedCfnNatGateway(software.amazon.jsii.JsiiObjectRef objRef) CfnNatGateway(software.constructs.Construct scope, String id) Create a newAWS::EC2::NatGateway.CfnNatGateway(software.constructs.Construct scope, String id, CfnNatGatewayProps props) Create a newAWS::EC2::NatGateway. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringarnForNatGateway(INatGatewayRef resource) static INatGatewayReffromNatGatewayId(software.constructs.Construct scope, String id, String natGatewayId) Creates a new INatGatewayRef from a natGatewayId.[Public NAT gateway only] The allocation ID of the Elastic IP address that's associated with the NAT gateway.For regional NAT gateways only: Indicates whether AWS automatically manages AZ coverage.For regional NAT gateways only: Indicates whether AWS automatically allocates additional Elastic IP addresses (EIPs) in an AZ when the NAT gateway needs more ports due to increased concurrent connections to a single destination from that AZ.The ID of the network interface.The ID of the NAT gateway.For regional NAT gateways only, this is the ID of the NAT gateway.Indicates whether this is a zonal (single-AZ) or regional (multi-AZ) NAT gateway.For regional NAT gateways only: Specifies which Availability Zones you want the NAT gateway to support and the Elastic IP addresses (EIPs) to use in each AZ.Indicates whether the NAT gateway supports public or private connectivity.The maximum amount of time to wait (in seconds) before forcibly releasing the IP addresses if connections are still in progress.A reference to a NatGateway resource.The private IPv4 address to assign to the NAT gateway.Secondary EIP allocation IDs.[Private NAT gateway only] The number of secondary private IPv4 addresses you want to assign to the NAT gateway.Secondary private IPv4 addresses.The ID of the subnet in which the NAT gateway is located.getTags()Tag Manager which manages the tags for this resource.The tags for the NAT gateway.getVpcId()The ID of the VPC in which the NAT gateway is located.voidinspect(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.static BooleanChecks whether the given object is a CfnNatGateway.renderProperties(Map<String, Object> props) voidsetAllocationId(String value) [Public NAT gateway only] The allocation ID of the Elastic IP address that's associated with the NAT gateway.voidsetAvailabilityMode(String value) Indicates whether this is a zonal (single-AZ) or regional (multi-AZ) NAT gateway.voidsetAvailabilityZoneAddresses(List<Object> value) For regional NAT gateways only: Specifies which Availability Zones you want the NAT gateway to support and the Elastic IP addresses (EIPs) to use in each AZ.voidFor regional NAT gateways only: Specifies which Availability Zones you want the NAT gateway to support and the Elastic IP addresses (EIPs) to use in each AZ.voidsetConnectivityType(String value) Indicates whether the NAT gateway supports public or private connectivity.voidsetMaxDrainDurationSeconds(Number value) The maximum amount of time to wait (in seconds) before forcibly releasing the IP addresses if connections are still in progress.voidsetPrivateIpAddress(String value) The private IPv4 address to assign to the NAT gateway.voidsetSecondaryAllocationIds(List<String> value) Secondary EIP allocation IDs.void[Private NAT gateway only] The number of secondary private IPv4 addresses you want to assign to the NAT gateway.voidsetSecondaryPrivateIpAddresses(List<String> value) Secondary private IPv4 addresses.voidsetSubnetId(String value) The ID of the subnet in which the NAT gateway is located.voidsetTagsRaw(List<CfnTag> value) The tags for the NAT gateway.voidThe ID of the VPC in which the NAT gateway is located.Methods inherited from class software.amazon.awscdk.CfnResource
addDeletionOverride, addDependency, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getAtt, getCfnOptions, getCfnResourceType, getEnv, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, obtainDependencies, obtainResourceDependencies, removeDependency, replaceDependency, shouldSynthesize, toString, validatePropertiesMethods inherited from class software.amazon.awscdk.CfnRefElement
getRefMethods inherited from class software.amazon.awscdk.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdMethods inherited from class software.constructs.Construct
getNode, isConstructMethods 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, wait, wait, waitMethods inherited from interface software.constructs.IConstruct
getNodeMethods inherited from interface software.amazon.awscdk.interfaces.IEnvironmentAware
getEnvMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
-
-
Constructor Details
-
CfnNatGateway
protected CfnNatGateway(software.amazon.jsii.JsiiObjectRef objRef) -
CfnNatGateway
protected CfnNatGateway(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnNatGateway
@Stability(Stable) public CfnNatGateway(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable CfnNatGatewayProps props) Create a newAWS::EC2::NatGateway.- Parameters:
scope- Scope in which this resource is defined. This parameter is required.id- Construct identifier for this resource (unique in its scope). This parameter is required.props- Resource properties.
-
CfnNatGateway
@Stability(Stable) public CfnNatGateway(@NotNull software.constructs.Construct scope, @NotNull String id) Create a newAWS::EC2::NatGateway.- Parameters:
scope- Scope in which this resource is defined. This parameter is required.id- Construct identifier for this resource (unique in its scope). This parameter is required.
-
-
Method Details
-
arnForNatGateway
- Parameters:
resource- This parameter is required.
-
fromNatGatewayId
@Stability(Stable) @NotNull public static INatGatewayRef fromNatGatewayId(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String natGatewayId) Creates a new INatGatewayRef from a natGatewayId.- Parameters:
scope- This parameter is required.id- This parameter is required.natGatewayId- This parameter is required.
-
isCfnNatGateway
Checks whether the given object is a CfnNatGateway.- Parameters:
x- This parameter is required.
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspectin interfaceIInspectable- Parameters:
inspector- tree inspector to collect and process attributes. This parameter is required.
-
renderProperties
@Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String, Object> props) - Overrides:
renderPropertiesin classCfnResource- Parameters:
props- This parameter is required.
-
getAttrAutoProvisionZones
For regional NAT gateways only: Indicates whether AWS automatically manages AZ coverage.When enabled, the NAT gateway associates EIPs in all AZs where your VPC has subnets to handle outbound NAT traffic, expands to new AZs when you create subnets there, and retracts from AZs where you've removed all subnets. When disabled, you must manually manage which AZs the NAT gateway supports and their corresponding EIPs.
A regional NAT gateway is a single NAT Gateway that works across multiple availability zones (AZs) in your VPC, providing redundancy, scalability and availability across all the AZs in a Region.
For more information, see Regional NAT gateways for automatic multi-AZ expansion in the Amazon VPC User Guide .
-
getAttrAutoScalingIps
For regional NAT gateways only: Indicates whether AWS automatically allocates additional Elastic IP addresses (EIPs) in an AZ when the NAT gateway needs more ports due to increased concurrent connections to a single destination from that AZ.For more information, see Regional NAT gateways for automatic multi-AZ expansion in the Amazon VPC User Guide .
-
getAttrEniId
The ID of the network interface. -
getAttrNatGatewayId
The ID of the NAT gateway. -
getAttrRouteTableId
For regional NAT gateways only, this is the ID of the NAT gateway. -
getCfnProperties
- Overrides:
getCfnPropertiesin classCfnResource
-
getNatGatewayRef
A reference to a NatGateway resource.- Specified by:
getNatGatewayRefin interfaceINatGatewayRef
-
getTags
Tag Manager which manages the tags for this resource. -
getAllocationId
[Public NAT gateway only] The allocation ID of the Elastic IP address that's associated with the NAT gateway. -
setAllocationId
[Public NAT gateway only] The allocation ID of the Elastic IP address that's associated with the NAT gateway. -
getAvailabilityMode
Indicates whether this is a zonal (single-AZ) or regional (multi-AZ) NAT gateway. -
setAvailabilityMode
Indicates whether this is a zonal (single-AZ) or regional (multi-AZ) NAT gateway. -
getAvailabilityZoneAddresses
For regional NAT gateways only: Specifies which Availability Zones you want the NAT gateway to support and the Elastic IP addresses (EIPs) to use in each AZ.Returns union: either
IResolvableor Listinvalid input: '<'eitherIResolvableorCfnNatGateway.AvailabilityZoneAddressProperty> -
setAvailabilityZoneAddresses
For regional NAT gateways only: Specifies which Availability Zones you want the NAT gateway to support and the Elastic IP addresses (EIPs) to use in each AZ. -
setAvailabilityZoneAddresses
For regional NAT gateways only: Specifies which Availability Zones you want the NAT gateway to support and the Elastic IP addresses (EIPs) to use in each AZ. -
getConnectivityType
Indicates whether the NAT gateway supports public or private connectivity. -
setConnectivityType
Indicates whether the NAT gateway supports public or private connectivity. -
getMaxDrainDurationSeconds
The maximum amount of time to wait (in seconds) before forcibly releasing the IP addresses if connections are still in progress. -
setMaxDrainDurationSeconds
The maximum amount of time to wait (in seconds) before forcibly releasing the IP addresses if connections are still in progress. -
getPrivateIpAddress
The private IPv4 address to assign to the NAT gateway. -
setPrivateIpAddress
The private IPv4 address to assign to the NAT gateway. -
getSecondaryAllocationIds
Secondary EIP allocation IDs. -
setSecondaryAllocationIds
Secondary EIP allocation IDs. -
getSecondaryPrivateIpAddressCount
[Private NAT gateway only] The number of secondary private IPv4 addresses you want to assign to the NAT gateway. -
setSecondaryPrivateIpAddressCount
[Private NAT gateway only] The number of secondary private IPv4 addresses you want to assign to the NAT gateway. -
getSecondaryPrivateIpAddresses
Secondary private IPv4 addresses. -
setSecondaryPrivateIpAddresses
Secondary private IPv4 addresses. -
getSubnetId
The ID of the subnet in which the NAT gateway is located. -
setSubnetId
The ID of the subnet in which the NAT gateway is located. -
getTagsRaw
The tags for the NAT gateway. -
setTagsRaw
The tags for the NAT gateway. -
getVpcId
The ID of the VPC in which the NAT gateway is located. -
setVpcId
The ID of the VPC in which the NAT gateway is located.
-