Class NatInstanceProviderV2

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.ec2.NatProvider
software.amazon.awscdk.services.ec2.NatInstanceProviderV2
All Implemented Interfaces:
IConnectable, software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.94.0 (build b380f01)", date="2024-03-14T22:21:53.961Z") @Stability(Stable) public class NatInstanceProviderV2 extends NatProvider implements IConnectable
Modern NAT provider which uses NAT Instances.

The instance uses Amazon Linux 2023 as the operating system.

Example:

 InstanceType instanceType;
 NatInstanceProviderV2 provider = NatProvider.instanceV2(NatInstanceProps.builder()
         .instanceType(instanceType)
         .defaultAllowedTraffic(NatTrafficDirection.OUTBOUND_ONLY)
         .build());
 Vpc.Builder.create(this, "TheVPC")
         .natGatewayProvider(provider)
         .build();
 provider.connections.allowFrom(Peer.ipv4("1.2.3.4/8"), Port.tcp(80));
 
  • Constructor Details

    • NatInstanceProviderV2

      protected NatInstanceProviderV2(software.amazon.jsii.JsiiObjectRef objRef)
    • NatInstanceProviderV2

      protected NatInstanceProviderV2(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • NatInstanceProviderV2

      @Stability(Stable) public NatInstanceProviderV2(@NotNull NatInstanceProps props)
      Parameters:
      props - This parameter is required.
  • Method Details

    • configureNat

      @Stability(Stable) public void configureNat(@NotNull ConfigureNatOptions options)
      Called by the VPC to configure NAT.

      Don't call this directly, the VPC will call it automatically.

      Specified by:
      configureNat in class NatProvider
      Parameters:
      options - This parameter is required.
    • configureSubnet

      @Stability(Stable) public void configureSubnet(@NotNull PrivateSubnet subnet)
      Configures subnet with the gateway.

      Don't call this directly, the VPC will call it automatically.

      Specified by:
      configureSubnet in class NatProvider
      Parameters:
      subnet - This parameter is required.
    • getConfiguredGateways

      @Stability(Stable) @NotNull public List<GatewayConfig> getConfiguredGateways()
      Return list of gateways spawned by the provider.
      Specified by:
      getConfiguredGateways in class NatProvider
    • getConnections

      @Stability(Stable) @NotNull public Connections getConnections()
      Manage the Security Groups associated with the NAT instances.
      Specified by:
      getConnections in interface IConnectable
    • getSecurityGroup

      @Stability(Stable) @NotNull public ISecurityGroup getSecurityGroup()
      The Security Group associated with the NAT instances.