Class CfnNatGateway
- All Implemented Interfaces:
IConstruct,IDependable,IInspectable,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct
AWS::EC2::NatGateway.
Specifies a network address translation (NAT) gateway in the specified subnet. 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.
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.
For more information, see NAT Gateways 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();
-
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.core.IConstruct
IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.core.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe CloudFormation resource type name for this resource class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionCfnNatGateway(Construct scope, String id, CfnNatGatewayProps props) Create a newAWS::EC2::NatGateway.protectedCfnNatGateway(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedCfnNatGateway(software.amazon.jsii.JsiiObjectRef objRef) -
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()The tags for the NAT gateway.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.Methods inherited from class software.amazon.awscdk.core.CfnResource
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, isCfnResource, shouldSynthesize, toString, validatePropertiesMethods inherited from class software.amazon.awscdk.core.CfnRefElement
getRefMethods inherited from class software.amazon.awscdk.core.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalIdMethods inherited from class software.amazon.awscdk.core.Construct
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validateMethods 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.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 Construct scope, @NotNull String id, @NotNull CfnNatGatewayProps props) Create a newAWS::EC2::NatGateway.- Parameters:
scope-- scope in which this resource is defined.
id-- scoped id of the resource.
props-- resource properties.
-
-
Method Details
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspectin interfaceIInspectable- Parameters:
inspector-- tree inspector to collect and process attributes.
-
renderProperties
@Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String, Object> props) - Overrides:
renderPropertiesin classCfnResource- Parameters:
props- This parameter is required.
-
getAttrNatGatewayId
The ID of the NAT gateway. -
getCfnProperties
- Overrides:
getCfnPropertiesin classCfnResource
-
getTags
The tags for the NAT gateway. -
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.This property is required for a public NAT gateway and cannot be specified with a private NAT gateway.
-
setAllocationId
[Public NAT gateway only] The allocation ID of the 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.
-
getConnectivityType
Indicates whether the NAT gateway supports public or private connectivity.The default is public connectivity.
-
setConnectivityType
Indicates whether the NAT gateway supports public or private connectivity.The default is public connectivity.
-
getMaxDrainDurationSeconds
The maximum amount of time to wait (in seconds) before forcibly releasing the IP addresses if connections are still in progress.Default value is 350 seconds.
-
setMaxDrainDurationSeconds
The maximum amount of time to wait (in seconds) before forcibly releasing the IP addresses if connections are still in progress.Default value is 350 seconds.
-
getPrivateIpAddress
The private IPv4 address to assign to the NAT gateway.If you don't provide an address, a private IPv4 address will be automatically assigned.
-
setPrivateIpAddress
The private IPv4 address to assign to the NAT gateway.If you don't provide an address, a private IPv4 address will be automatically assigned.
-
getSecondaryAllocationIds
Secondary EIP allocation IDs.For more information, see Create a NAT gateway in the Amazon VPC User Guide .
-
setSecondaryAllocationIds
Secondary EIP allocation IDs.For more information, see Create a NAT gateway in the Amazon VPC User Guide .
-
getSecondaryPrivateIpAddressCount
[Private NAT gateway only] The number of secondary private IPv4 addresses you want to assign to the NAT gateway.For more information about secondary addresses, see Create a NAT gateway in the Amazon Virtual Private Cloud User Guide .
SecondaryPrivateIpAddressCountandSecondaryPrivateIpAddressescannot be set at the same time. -
setSecondaryPrivateIpAddressCount
[Private NAT gateway only] The number of secondary private IPv4 addresses you want to assign to the NAT gateway.For more information about secondary addresses, see Create a NAT gateway in the Amazon Virtual Private Cloud User Guide .
SecondaryPrivateIpAddressCountandSecondaryPrivateIpAddressescannot be set at the same time. -
getSecondaryPrivateIpAddresses
Secondary private IPv4 addresses.For more information about secondary addresses, see Create a NAT gateway in the Amazon Virtual Private Cloud User Guide .
SecondaryPrivateIpAddressCountandSecondaryPrivateIpAddressescannot be set at the same time. -
setSecondaryPrivateIpAddresses
Secondary private IPv4 addresses.For more information about secondary addresses, see Create a NAT gateway in the Amazon Virtual Private Cloud User Guide .
SecondaryPrivateIpAddressCountandSecondaryPrivateIpAddressescannot be set at the same time.
-