Class NatProvider
NAT providers.
Namespace: Amazon.CDK.AWS.EC2
Assembly: Amazon.CDK.AWS.EC2.dll
Syntax (csharp)
public abstract class NatProvider : DeputyBase
Syntax (vb)
Public MustInherit Class NatProvider
Inherits DeputyBase
Remarks
Determines what type of NAT provider to create, either NAT gateways or NAT instance.
ExampleMetadata: lit=test/integ.nat-instances.lit.ts infused
Examples
// Configure the `natGatewayProvider` when defining a Vpc
var natGatewayProvider = NatProvider.Instance(new NatInstanceProps {
InstanceType = new InstanceType("t3.small")
});
var vpc = new Vpc(this, "MyVpc", new VpcProps {
NatGatewayProvider = natGatewayProvider,
// The 'natGateways' parameter now controls the number of NAT instances
NatGateways = 2
});
Synopsis
Constructors
NatProvider() | |
NatProvider(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
NatProvider(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Properties
ConfiguredGateways | Return list of gateways spawned by the provider. |
Methods
ConfigureNat(IConfigureNatOptions) | Called by the VPC to configure NAT. |
ConfigureSubnet(PrivateSubnet) | Configures subnet with the gateway. |
Gateway(INatGatewayProps) | Use NAT Gateways to provide NAT services for your VPC. |
Instance(INatInstanceProps) | Use NAT instances to provide NAT services for your VPC. |
Constructors
NatProvider()
protected NatProvider()
NatProvider(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected NatProvider(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
NatProvider(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected NatProvider(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Properties
ConfiguredGateways
Return list of gateways spawned by the provider.
public abstract IGatewayConfig[] ConfiguredGateways { get; }
Property Value
Methods
ConfigureNat(IConfigureNatOptions)
Called by the VPC to configure NAT.
public abstract void ConfigureNat(IConfigureNatOptions options)
Parameters
- options IConfigureNatOptions
Remarks
Don't call this directly, the VPC will call it automatically.
ConfigureSubnet(PrivateSubnet)
Configures subnet with the gateway.
public abstract void ConfigureSubnet(PrivateSubnet subnet)
Parameters
- subnet PrivateSubnet
Remarks
Don't call this directly, the VPC will call it automatically.
Gateway(INatGatewayProps)
Use NAT Gateways to provide NAT services for your VPC.
public static NatProvider Gateway(INatGatewayProps props = null)
Parameters
- props INatGatewayProps
Returns
Remarks
NAT gateways are managed by AWS.
See: https://docs.aws.amazon.com/vpc/latest/userguide/vpc-nat-gateway.html
Instance(INatInstanceProps)
Use NAT instances to provide NAT services for your VPC.
public static NatInstanceProvider Instance(INatInstanceProps props)
Parameters
- props INatInstanceProps
Returns
Remarks
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.
See: https://docs.aws.amazon.com/vpc/latest/userguide/VPC_NAT_Instance.html