class NatProvider
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.EC2.NatProvider |
Java | software.amazon.awscdk.services.ec2.NatProvider |
Python | aws_cdk.aws_ec2.NatProvider |
TypeScript (source) | @aws-cdk/aws-ec2 » NatProvider |
Implemented by
Nat
NAT providers.
Determines what type of NAT provider to create, either NAT gateways or NAT instance.
Example
// Configure the `natGatewayProvider` when defining a Vpc
const natGatewayProvider = ec2.NatProvider.instance({
instanceType: new ec2.InstanceType('t3.small'),
});
const vpc = new ec2.Vpc(this, 'MyVpc', {
natGatewayProvider,
// The 'natGateways' parameter now controls the number of NAT instances
natGateways: 2,
});
Initializer
new NatProvider()
Properties
Name | Type | Description |
---|---|---|
configured | Gateway [] | Return list of gateways spawned by the provider. |
configuredGateways
Type:
Gateway
[]
Return list of gateways spawned by the provider.
Methods
Name | Description |
---|---|
configure | Called by the VPC to configure NAT. |
configure | Configures subnet with the gateway. |
static gateway(props?) | Use NAT Gateways to provide NAT services for your VPC. |
static instance(props) | Use NAT instances to provide NAT services for your VPC. |
Nat(options)
configurepublic configureNat(options: ConfigureNatOptions): void
Parameters
- options
Configure
Nat Options
Called by the VPC to configure NAT.
Don't call this directly, the VPC will call it automatically.
Subnet(subnet)
configurepublic configureSubnet(subnet: PrivateSubnet): void
Parameters
- subnet
Private
Subnet
Configures subnet with the gateway.
Don't call this directly, the VPC will call it automatically.
static gateway(props?)
public static gateway(props?: NatGatewayProps): NatProvider
Parameters
- props
Nat
Gateway Props
Returns
Use NAT Gateways to provide NAT services for your VPC.
NAT gateways are managed by AWS.
See also: https://docs.aws.amazon.com/vpc/latest/userguide/vpc-nat-gateway.html
static instance(props)
public static instance(props: NatInstanceProps): NatInstanceProvider
Parameters
- props
Nat
Instance Props
Returns
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.
See also: https://docs.aws.amazon.com/vpc/latest/userguide/VPC_NAT_Instance.html