Class NatProvider

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.ec2.NatProvider
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable
Direct Known Subclasses:
NatInstanceProvider, NatInstanceProviderV2

@Generated(value="jsii-pacmak/1.101.0 (build b95fe5d)", date="2024-07-22T22:42:50.810Z") @Stability(Stable) public abstract class NatProvider extends software.amazon.jsii.JsiiObject
NAT providers.

Determines what type of NAT provider to create, either NAT gateways or NAT instance.

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.HTTP);
 
  • Constructor Details

    • NatProvider

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

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

      @Stability(Stable) protected NatProvider()
  • Method Details

    • gateway

      @Stability(Stable) @NotNull public static NatProvider gateway(@Nullable NatGatewayProps props)
      Use NAT Gateways to provide NAT services for your VPC.

      NAT gateways are managed by AWS.

      Parameters:
      props -
      See Also:
    • gateway

      @Stability(Stable) @NotNull public static NatProvider gateway()
      Use NAT Gateways to provide NAT services for your VPC.

      NAT gateways are managed by AWS.

      See Also:
    • instance

      @Stability(Deprecated) @Deprecated @NotNull public static NatInstanceProvider instance(@NotNull NatInstanceProps props)
      Deprecated.
      use instanceV2. 'instance' is deprecated since NatInstanceProvider uses a instance image that has reached EOL on Dec 31 2023
      (deprecated) Use NAT instances to provide NAT services for your VPC.

      NAT instances are managed by you, but in return allow more configuration.

      Be aware that instances created using this provider will not be automatically replaced if they are stopped for any reason. You should implement your own NatProvider based on AutoScaling groups if you need that.

      Parameters:
      props - This parameter is required.
      See Also:
    • instanceV2

      @Stability(Stable) @NotNull public static NatInstanceProviderV2 instanceV2(@NotNull NatInstanceProps props)
      Use NAT instances to provide NAT services for your VPC.

      NAT instances are managed by you, but in return allow more configuration.

      Be aware that instances created using this provider will not be automatically replaced if they are stopped for any reason. You should implement your own NatProvider based on AutoScaling groups if you need that.

      Parameters:
      props - This parameter is required.
      See Also:
    • configureNat

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

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

      Parameters:
      options - This parameter is required.
    • configureSubnet

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

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

      Parameters:
      subnet - This parameter is required.
    • getConfiguredGateways

      @Stability(Stable) @NotNull public abstract List<GatewayConfig> getConfiguredGateways()
      Return list of gateways spawned by the provider.