Skip to content

Latest commit

 

History

History
275 lines (163 loc) · 10.2 KB

API.md

File metadata and controls

275 lines (163 loc) · 10.2 KB

API Reference

Structs

NatAsgProviderProps

Properties to configure NatAsgProvider.

Initializer

import { NatAsgProviderProps } from 'cdk-nat-asg-provider'

const natAsgProviderProps: NatAsgProviderProps = { ... }

Properties

Name Type Description
instanceType aws-cdk-lib.aws_ec2.InstanceType The EC2 instance type of the NAT instances.
keyPair string The name of the SSH key pair granting access to the NAT instances.
securityGroup aws-cdk-lib.aws_ec2.ISecurityGroup The security group associated with the NAT instances.
trafficDirection aws-cdk-lib.aws_ec2.NatTrafficDirection The allowed traffic directions through the NAT instances.

instanceTypeOptional
public readonly instanceType: InstanceType;
  • Type: aws-cdk-lib.aws_ec2.InstanceType
  • Default: t2.micro

The EC2 instance type of the NAT instances.

https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.InstanceType.html


keyPairOptional
public readonly keyPair: string;
  • Type: string

The name of the SSH key pair granting access to the NAT instances.

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-key-pairs.html


securityGroupOptional
public readonly securityGroup: ISecurityGroup;
  • Type: aws-cdk-lib.aws_ec2.ISecurityGroup
  • Default: A security group will be created.

The security group associated with the NAT instances.

https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.ISecurityGroup.html


trafficDirectionOptional
public readonly trafficDirection: NatTrafficDirection;
  • Type: aws-cdk-lib.aws_ec2.NatTrafficDirection
  • Default: aws-cdk-lib.aws_ec2.NatTrafficDirection.INBOUND_AND_OUTBOUND

The allowed traffic directions through the NAT instances.

If you set this to a value other than ec2.NatTrafficDirection.INBOUND_AND_OUTBOUND, you must configure the security group for the NAT instances either by providing a fully configured security group through the securityGroup property or by using the NatAsgProvider object's securityGroup or connections properties after passing the NatAsgProvider object to a Vpc object.

https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.NatTrafficDirection.html


Classes

NatAsgProvider

  • Implements: aws-cdk-lib.aws_ec2.IConnectable

NatAsgProvider is a NAT provider that places each NAT instance in its own auto scaling group to improve fault tolerance and availability.

NatAsgProvider extends NatProvider:

https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.NatProvider.html

Initializers

import { NatAsgProvider } from 'cdk-nat-asg-provider'

new NatAsgProvider(props: NatAsgProviderProps)
Name Type Description
props NatAsgProviderProps Configuration properties.

propsRequired

Configuration properties.


Methods

Name Description
configureNat Called by the VPC to configure NAT.
configureSubnet Configures subnet with the gateway.

configureNat
public configureNat(opts: ConfigureNatOptions): void

Called by the VPC to configure NAT.

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

optsRequired
  • Type: aws-cdk-lib.aws_ec2.ConfigureNatOptions

configureSubnet
public configureSubnet(subnet: PrivateSubnet): void

Configures subnet with the gateway.

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

subnetRequired
  • Type: aws-cdk-lib.aws_ec2.PrivateSubnet

Static Functions

Name Description
gateway Use NAT Gateways to provide NAT services for your VPC.
instance Use NAT instances to provide NAT services for your VPC.

gateway
import { NatAsgProvider } from 'cdk-nat-asg-provider'

NatAsgProvider.gateway(props?: NatGatewayProps)

Use NAT Gateways to provide NAT services for your VPC.

NAT gateways are managed by AWS.

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

propsOptional
  • Type: aws-cdk-lib.aws_ec2.NatGatewayProps

instance
import { NatAsgProvider } from 'cdk-nat-asg-provider'

NatAsgProvider.instance(props: NatInstanceProps)

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.

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

propsRequired
  • Type: aws-cdk-lib.aws_ec2.NatInstanceProps

Properties

Name Type Description
configuredGateways aws-cdk-lib.aws_ec2.GatewayConfig[] Return list of gateways spawned by the provider.
connections aws-cdk-lib.aws_ec2.Connections The network connections associated with the security group of the NAT instances.
securityGroup aws-cdk-lib.aws_ec2.ISecurityGroup The security group associated with the NAT instances.

configuredGatewaysRequired
public readonly configuredGateways: GatewayConfig[];
  • Type: aws-cdk-lib.aws_ec2.GatewayConfig[]

Return list of gateways spawned by the provider.


connectionsRequired
public readonly connections: Connections;
  • Type: aws-cdk-lib.aws_ec2.Connections

The network connections associated with the security group of the NAT instances.

https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.Connections.html


securityGroupRequired
public readonly securityGroup: ISecurityGroup;
  • Type: aws-cdk-lib.aws_ec2.ISecurityGroup

The security group associated with the NAT instances.

https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.ISecurityGroup.html