NatProvider

class aws_cdk.aws_ec2.NatProvider

Bases: object

NAT providers.

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

stability :stability: experimental

__init__()

Initialize self. See help(type(self)) for accurate signature.

Return type

None

Methods

configure_nat(*, nat_subnets, private_subnets, vpc)

Called by the VPC to configure NAT.

Parameters
  • options

  • nat_subnets (List[PublicSubnet]) – The public subnets where the NAT providers need to be placed.

  • private_subnets (List[PrivateSubnet]) – The private subnets that need to route through the NAT providers. There may be more private subnets than public subnets with NAT providers.

  • vpc (Vpc) – The VPC we’re configuring NAT for.

stability :stability: experimental

Return type

None

Static Methods

classmethod gateway()

Use NAT Gateways to provide NAT services for your VPC.

NAT gateways are managed by AWS.

see :see: https://docs.aws.amazon.com/vpc/latest/userguide/vpc-nat-gateway.html stability :stability: experimental

Return type

NatProvider

classmethod instance(*, instance_type, key_name=None, machine_image=None)

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

  • instance_type (InstanceType) – Instance type of the NAT instance.

  • key_name (Optional[str]) – Name of SSH keypair to grant access to instance. Default: - No SSH access will be possible.

  • machine_image (Optional[IMachineImage]) – The machine image (AMI) to use. By default, will do an AMI lookup for the latest NAT instance image. If you have a specific AMI ID you want to use, pass a GenericLinuxImage. For example:: NatProvider.instance({ instanceType: new InstanceType(‘t3.micro’), machineImage: new GenericLinuxImage({ ‘us-east-2’: ‘ami-0f9c61b5a562a16af’ }) }) Default: - Latest NAT instance image

see :see: https://docs.aws.amazon.com/vpc/latest/userguide/VPC_NAT_Instance.html stability :stability: experimental

Return type

NatProvider