Class CfnNatGateway
- All Implemented Interfaces:
IEnvironmentAware,IInspectable,ITaggable,INatGatewayRef,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")
.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 ClassesNested 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.services.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) CfnNatGateway(software.constructs.Construct scope, String id, CfnNatGatewayProps props) -
Method Summary
Modifier and TypeMethodDescriptionstatic 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.The ID of the network interface.The ID of the NAT gateway.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.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.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.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) - 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) - 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
-
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.
-
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.
-
getAttrEniId
The ID of the network interface. -
getAttrNatGatewayId
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. -
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.
-