@Generated(value="jsii-pacmak/1.74.0 (build 6d08790)", date="2023-03-22T19:35:42.582Z") public class CfnNatGateway extends CfnResource implements IInspectable
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();
Modifier and Type | Class and Description |
---|---|
static class |
CfnNatGateway.Builder
A fluent builder for
CfnNatGateway . |
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
IConstruct.Jsii$Default
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
|
Modifier | Constructor and Description |
---|---|
|
CfnNatGateway(Construct scope,
java.lang.String id,
CfnNatGatewayProps props)
Create a new `AWS::EC2::NatGateway`.
|
protected |
CfnNatGateway(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
CfnNatGateway(software.amazon.jsii.JsiiObjectRef objRef) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAllocationId()
[Public NAT gateway only] The allocation ID of the Elastic IP address that's associated with the NAT gateway.
|
java.lang.String |
getAttrNatGatewayId()
The ID of the NAT gateway.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
getCfnProperties() |
java.lang.String |
getConnectivityType()
Indicates whether the NAT gateway supports public or private connectivity.
|
java.lang.Number |
getMaxDrainDurationSeconds()
The maximum amount of time to wait (in seconds) before forcibly releasing the IP addresses if connections are still in progress.
|
java.lang.String |
getPrivateIpAddress()
The private IPv4 address to assign to the NAT gateway.
|
java.util.List<java.lang.String> |
getSecondaryAllocationIds()
Secondary EIP allocation IDs.
|
java.lang.Number |
getSecondaryPrivateIpAddressCount()
[Private NAT gateway only] The number of secondary private IPv4 addresses you want to assign to the NAT gateway.
|
java.util.List<java.lang.String> |
getSecondaryPrivateIpAddresses()
Secondary private IPv4 addresses.
|
java.lang.String |
getSubnetId()
The ID of the subnet in which the NAT gateway is located.
|
TagManager |
getTags()
The tags for the NAT gateway.
|
void |
inspect(TreeInspector inspector)
Examines the CloudFormation resource and discloses attributes.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
renderProperties(java.util.Map<java.lang.String,java.lang.Object> props) |
void |
setAllocationId(java.lang.String value)
[Public NAT gateway only] The allocation ID of the Elastic IP address that's associated with the NAT gateway.
|
void |
setConnectivityType(java.lang.String value)
Indicates whether the NAT gateway supports public or private connectivity.
|
void |
setMaxDrainDurationSeconds(java.lang.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(java.lang.String value)
The private IPv4 address to assign to the NAT gateway.
|
void |
setSecondaryAllocationIds(java.util.List<java.lang.String> value)
Secondary EIP allocation IDs.
|
void |
setSecondaryPrivateIpAddressCount(java.lang.Number value)
[Private NAT gateway only] The number of secondary private IPv4 addresses you want to assign to the NAT gateway.
|
void |
setSecondaryPrivateIpAddresses(java.util.List<java.lang.String> value)
Secondary private IPv4 addresses.
|
void |
setSubnetId(java.lang.String value)
The ID of the subnet in which the NAT gateway is located.
|
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, isCfnResource, shouldSynthesize, toString, validateProperties
getRef
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
public static final java.lang.String CFN_RESOURCE_TYPE_NAME
protected CfnNatGateway(software.amazon.jsii.JsiiObjectRef objRef)
protected CfnNatGateway(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public CfnNatGateway(Construct scope, java.lang.String id, CfnNatGatewayProps props)
scope
- - scope in which this resource is defined. This parameter is required.id
- - scoped id of the resource. This parameter is required.props
- - resource properties. This parameter is required.public void inspect(TreeInspector inspector)
inspect
in interface IInspectable
inspector
- - tree inspector to collect and process attributes. This parameter is required.protected java.util.Map<java.lang.String,java.lang.Object> renderProperties(java.util.Map<java.lang.String,java.lang.Object> props)
renderProperties
in class CfnResource
props
- This parameter is required.public java.lang.String getAttrNatGatewayId()
protected java.util.Map<java.lang.String,java.lang.Object> getCfnProperties()
getCfnProperties
in class CfnResource
public TagManager getTags()
public java.lang.String getSubnetId()
public void setSubnetId(java.lang.String value)
public java.lang.String getAllocationId()
This property is required for a public NAT gateway and cannot be specified with a private NAT gateway.
public void setAllocationId(java.lang.String value)
This property is required for a public NAT gateway and cannot be specified with a private NAT gateway.
public java.lang.String getConnectivityType()
The default is public connectivity.
public void setConnectivityType(java.lang.String value)
The default is public connectivity.
public java.lang.Number getMaxDrainDurationSeconds()
Default value is 350 seconds.
public void setMaxDrainDurationSeconds(java.lang.Number value)
Default value is 350 seconds.
public java.lang.String getPrivateIpAddress()
If you don't provide an address, a private IPv4 address will be automatically assigned.
public void setPrivateIpAddress(java.lang.String value)
If you don't provide an address, a private IPv4 address will be automatically assigned.
public java.util.List<java.lang.String> getSecondaryAllocationIds()
For more information about secondary addresses, see Create a NAT gateway in the Amazon Virtual Private Cloud User Guide .
public void setSecondaryAllocationIds(java.util.List<java.lang.String> value)
For more information about secondary addresses, see Create a NAT gateway in the Amazon Virtual Private Cloud User Guide .
public java.lang.Number getSecondaryPrivateIpAddressCount()
For more information about secondary addresses, see Create a NAT gateway in the Amazon Virtual Private Cloud User Guide .
SecondaryPrivateIpAddressCount
andSecondaryPrivateIpAddresses
cannot be set at the same time.
public void setSecondaryPrivateIpAddressCount(java.lang.Number value)
For more information about secondary addresses, see Create a NAT gateway in the Amazon Virtual Private Cloud User Guide .
SecondaryPrivateIpAddressCount
andSecondaryPrivateIpAddresses
cannot be set at the same time.
public java.util.List<java.lang.String> getSecondaryPrivateIpAddresses()
For more information about secondary addresses, see Create a NAT gateway in the Amazon Virtual Private Cloud User Guide .
SecondaryPrivateIpAddressCount
andSecondaryPrivateIpAddresses
cannot be set at the same time.
public void setSecondaryPrivateIpAddresses(java.util.List<java.lang.String> value)
For more information about secondary addresses, see Create a NAT gateway in the Amazon Virtual Private Cloud User Guide .
SecondaryPrivateIpAddressCount
andSecondaryPrivateIpAddresses
cannot be set at the same time.