Class CfnNatGateway

java.lang.Object
software.amazon.jsii.JsiiObject
All Implemented Interfaces:
IConstruct, IDependable, IInspectable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:38.782Z") @Stability(Stable) public class CfnNatGateway extends CfnResource implements IInspectable
A CloudFormation 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();
 
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String 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 new AWS::EC2::NatGateway.

      Parameters:
      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.
  • Method Details

    • inspect

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      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 class CfnResource
      Parameters:
      props - This parameter is required.
    • getAttrNatGatewayId

      @Stability(Stable) @NotNull public String getAttrNatGatewayId()
      The ID of the NAT gateway.
    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getTags

      @Stability(Stable) @NotNull public TagManager getTags()
      The tags for the NAT gateway.
    • getSubnetId

      @Stability(Stable) @NotNull public String getSubnetId()
      The ID of the subnet in which the NAT gateway is located.
    • setSubnetId

      @Stability(Stable) public void setSubnetId(@NotNull String value)
      The ID of the subnet in which the NAT gateway is located.
    • getAllocationId

      @Stability(Stable) @Nullable public String 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

      @Stability(Stable) public void setAllocationId(@Nullable String value)
      [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

      @Stability(Stable) @Nullable public String getConnectivityType()
      Indicates whether the NAT gateway supports public or private connectivity.

      The default is public connectivity.

    • setConnectivityType

      @Stability(Stable) public void setConnectivityType(@Nullable String value)
      Indicates whether the NAT gateway supports public or private connectivity.

      The default is public connectivity.

    • getMaxDrainDurationSeconds

      @Stability(Stable) @Nullable public Number 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

      @Stability(Stable) public void setMaxDrainDurationSeconds(@Nullable Number value)
      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

      @Stability(Stable) @Nullable public String 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

      @Stability(Stable) public void setPrivateIpAddress(@Nullable String value)
      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

      @Stability(Stable) @Nullable public List<String> getSecondaryAllocationIds()
      Secondary EIP allocation IDs.

      For more information, see Create a NAT gateway in the Amazon VPC User Guide .

    • setSecondaryAllocationIds

      @Stability(Stable) public void setSecondaryAllocationIds(@Nullable List<String> value)
      Secondary EIP allocation IDs.

      For more information, see Create a NAT gateway in the Amazon VPC User Guide .

    • getSecondaryPrivateIpAddressCount

      @Stability(Stable) @Nullable public Number 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 .

      SecondaryPrivateIpAddressCount and SecondaryPrivateIpAddresses cannot be set at the same time.

    • setSecondaryPrivateIpAddressCount

      @Stability(Stable) public void setSecondaryPrivateIpAddressCount(@Nullable Number value)
      [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 .

      SecondaryPrivateIpAddressCount and SecondaryPrivateIpAddresses cannot be set at the same time.

    • getSecondaryPrivateIpAddresses

      @Stability(Stable) @Nullable public List<String> getSecondaryPrivateIpAddresses()
      Secondary private IPv4 addresses.

      For more information about secondary addresses, see Create a NAT gateway in the Amazon Virtual Private Cloud User Guide .

      SecondaryPrivateIpAddressCount and SecondaryPrivateIpAddresses cannot be set at the same time.

    • setSecondaryPrivateIpAddresses

      @Stability(Stable) public void setSecondaryPrivateIpAddresses(@Nullable List<String> value)
      Secondary private IPv4 addresses.

      For more information about secondary addresses, see Create a NAT gateway in the Amazon Virtual Private Cloud User Guide .

      SecondaryPrivateIpAddressCount and SecondaryPrivateIpAddresses cannot be set at the same time.