Skip to content

Latest commit

 

History

History
454 lines (277 loc) · 14.8 KB

API.md

File metadata and controls

454 lines (277 loc) · 14.8 KB

API Reference

Constructs

SimpleNAT

Simple NAT instances construct.

Initializers

import { SimpleNAT } from 'cdk-construct-simple-nat'

new SimpleNAT(scope: Construct, id: string, props: SimpleNATProps)
Name Type Description
scope constructs.Construct No description.
id string No description.
props SimpleNATProps No description.

scopeRequired
  • Type: constructs.Construct

idRequired
  • Type: string

propsRequired

Methods

Name Description
toString Returns a string representation of this construct.
applyRemovalPolicy Apply the given removal policy to this resource.
addV4Route No description.
addV6Route No description.
withCloudflareRoute Add Cloudflare IPs to route table.
withGithubRoute Add Github IPs to route table.
withGoogleRoute Add Google IPs to route table.

toString
public toString(): string

Returns a string representation of this construct.

applyRemovalPolicy
public applyRemovalPolicy(policy: RemovalPolicy): void

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

policyRequired
  • Type: aws-cdk-lib.RemovalPolicy

addV4Route
public addV4Route(v4CIDR: string): SimpleNAT
v4CIDRRequired
  • Type: string

addV6Route
public addV6Route(v6CIDR: string): SimpleNAT
v6CIDRRequired
  • Type: string

withCloudflareRoute
public withCloudflareRoute(props?: RouteProps): SimpleNAT

Add Cloudflare IPs to route table.

See https://www.cloudflare.com/ips/ for details

propsOptional

withGithubRoute
public withGithubRoute(props?: RouteProps): SimpleNAT

Add Github IPs to route table.

propsOptional

withGoogleRoute
public withGoogleRoute(props?: RouteProps): SimpleNAT

Add Google IPs to route table.

propsOptional

Static Functions

Name Description
isConstruct Checks if x is a construct.
isOwnedResource Returns true if the construct was created by CDK, and false otherwise.
isResource Check whether the given construct is a Resource.

isConstruct
import { SimpleNAT } from 'cdk-construct-simple-nat'

SimpleNAT.isConstruct(x: any)

Checks if x is a construct.

xRequired
  • Type: any

Any object.


isOwnedResource
import { SimpleNAT } from 'cdk-construct-simple-nat'

SimpleNAT.isOwnedResource(construct: IConstruct)

Returns true if the construct was created by CDK, and false otherwise.

constructRequired
  • Type: constructs.IConstruct

isResource
import { SimpleNAT } from 'cdk-construct-simple-nat'

SimpleNAT.isResource(construct: IConstruct)

Check whether the given construct is a Resource.

constructRequired
  • Type: constructs.IConstruct

Properties

Name Type Description
node constructs.Node The tree node.
env aws-cdk-lib.ResourceEnvironment The environment this resource belongs to.
stack aws-cdk-lib.Stack The stack in which this resource is defined.

nodeRequired
public readonly node: Node;
  • Type: constructs.Node

The tree node.


envRequired
public readonly env: ResourceEnvironment;
  • Type: aws-cdk-lib.ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.


stackRequired
public readonly stack: Stack;
  • Type: aws-cdk-lib.Stack

The stack in which this resource is defined.


Constants

Name Type Description
Ipv6Regex string No description.

Ipv6RegexRequired
public readonly Ipv6Regex: string;
  • Type: string

Structs

RouteProps

Properties for how adding IPs to route.

Initializer

import { RouteProps } from 'cdk-construct-simple-nat'

const routeProps: RouteProps = { ... }

Properties

Name Type Description
excludeIPv6 boolean If excluding IPv6 when creating route.

excludeIPv6Optional
public readonly excludeIPv6: boolean;
  • Type: boolean
  • Default: false

If excluding IPv6 when creating route.


SimpleNATProps

Properties for NAT instances.

Initializer

import { SimpleNATProps } from 'cdk-construct-simple-nat'

const simpleNATProps: SimpleNATProps = { ... }

Properties

Name Type Description
vpc aws-cdk-lib.aws_ec2.IVpc The VPC the NAT instances will reside.
customScripts string The custom script when provisioning the NAT instances.
instanceType aws-cdk-lib.aws_ec2.InstanceType The instance type of NAT instances.
keyName string The key name of ssh key of NAT instances.
machineImage aws-cdk-lib.aws_ec2.IMachineImage The AMI of NAT instances.
natSubnetsSelection aws-cdk-lib.aws_ec2.SubnetSelection The subnet selection for NAT instances, one NAT instance will be placed in the selected subnets.
privateSubnetsSelection aws-cdk-lib.aws_ec2.SubnetSelection The subnet selection for updating route tables for selected subnets.
role aws-cdk-lib.aws_iam.IRole The IAM role attached to NAT instances.

vpcRequired
public readonly vpc: IVpc;
  • Type: aws-cdk-lib.aws_ec2.IVpc

The VPC the NAT instances will reside.


customScriptsOptional
public readonly customScripts: string;
  • Type: string
  • Default: no custom script.

The custom script when provisioning the NAT instances.


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

The instance type of NAT instances.


keyNameOptional
public readonly keyName: string;
  • Type: string
  • Default: No SSH access will be possible.

The key name of ssh key of NAT instances.


machineImageOptional
public readonly machineImage: IMachineImage;
  • Type: aws-cdk-lib.aws_ec2.IMachineImage
  • Default: Amazon Linux 2 for x86_64.

The AMI of NAT instances.


natSubnetsSelectionOptional
public readonly natSubnetsSelection: SubnetSelection;
  • Type: aws-cdk-lib.aws_ec2.SubnetSelection
  • Default: subnetType is SubnetType.PUBLIC and onePerAZ is true.

The subnet selection for NAT instances, one NAT instance will be placed in the selected subnets.

NOTE: must select the public subnet


privateSubnetsSelectionOptional
public readonly privateSubnetsSelection: SubnetSelection;
  • Type: aws-cdk-lib.aws_ec2.SubnetSelection
  • Default: subnetType is SubnetType.PRIVATE_WITH_NAT.

The subnet selection for updating route tables for selected subnets.


roleOptional
public readonly role: IRole;
  • Type: aws-cdk-lib.aws_iam.IRole
  • Default: an IAM role is created.

The IAM role attached to NAT instances.