Class CfnNatGateway
- All Implemented Interfaces:
IInspectable
,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") .subnetId("subnetId") // the properties below are optional .allocationId("allocationId") .connectivityType("connectivityType") .maxDrainDurationSeconds(123) .privateIpAddress("privateIpAddress") .secondaryAllocationIds(List.of("secondaryAllocationIds")) .secondaryPrivateIpAddressCount(123) .secondaryPrivateIpAddresses(List.of("secondaryPrivateIpAddresses")) .tags(List.of(CfnTag.builder() .key("key") .value("value") .build())) .build();
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
Nested classes/interfaces inherited from interface software.amazon.awscdk.ITaggable
ITaggable.Jsii$Default, ITaggable.Jsii$Proxy
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The CloudFormation resource type name for this resource class. -
Constructor Summary
ModifierConstructorDescriptionprotected
CfnNatGateway
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
CfnNatGateway
(software.amazon.jsii.JsiiObjectRef objRef) CfnNatGateway
(software.constructs.Construct scope, String id, CfnNatGatewayProps props) -
Method Summary
Modifier and TypeMethodDescription[Public NAT gateway only] The allocation ID of the Elastic IP address that's associated with the NAT gateway.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.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.void
inspect
(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties
(Map<String, Object> props) void
setAllocationId
(String value) [Public NAT gateway only] The allocation ID of the Elastic IP address that's associated with the NAT gateway.void
setConnectivityType
(String value) Indicates whether the NAT gateway supports public or private connectivity.void
setMaxDrainDurationSeconds
(Number value) The maximum amount of time to wait (in seconds) before forcibly releasing the IP addresses if connections are still in progress.void
setPrivateIpAddress
(String value) The private IPv4 address to assign to the NAT gateway.void
setSecondaryAllocationIds
(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.void
setSecondaryPrivateIpAddresses
(List<String> value) Secondary private IPv4 addresses.void
setSubnetId
(String value) The ID of the subnet in which the NAT gateway is located.void
setTagsRaw
(List<CfnTag> value) The tags for the NAT gateway.Methods inherited from class software.amazon.awscdk.CfnResource
addDeletionOverride, addDependency, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, obtainDependencies, obtainResourceDependencies, removeDependency, replaceDependency, shouldSynthesize, toString, validateProperties
Methods inherited from class software.amazon.awscdk.CfnRefElement
getRef
Methods inherited from class software.amazon.awscdk.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
Methods inherited from class software.constructs.Construct
getNode, isConstruct
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods 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, @NotNull 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. This parameter is required.
-
-
Method Details
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspect
in 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:
renderProperties
in classCfnResource
- Parameters:
props
- This parameter is required.
-
getAttrNatGatewayId
The ID of the NAT gateway. -
getCfnProperties
- Overrides:
getCfnProperties
in classCfnResource
-
getTags
Tag Manager which manages the tags for this resource. -
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. -
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. -
getTagsRaw
The tags for the NAT gateway. -
setTagsRaw
The tags for the NAT gateway.
-