Simple NAT instances construct.
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. |
- Type: constructs.Construct
- Type: string
- Type: SimpleNATProps
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. |
public toString(): string
Returns a string representation of this construct.
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
).
- Type: aws-cdk-lib.RemovalPolicy
public addV4Route(v4CIDR: string): SimpleNAT
- Type: string
public addV6Route(v6CIDR: string): SimpleNAT
- Type: string
public withCloudflareRoute(props?: RouteProps): SimpleNAT
Add Cloudflare IPs to route table.
See https://www.cloudflare.com/ips/ for details
- Type: RouteProps
public withGithubRoute(props?: RouteProps): SimpleNAT
Add Github IPs to route table.
- Type: RouteProps
public withGoogleRoute(props?: RouteProps): SimpleNAT
Add Google IPs to route table.
- Type: RouteProps
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. |
import { SimpleNAT } from 'cdk-construct-simple-nat'
SimpleNAT.isConstruct(x: any)
Checks if x
is a construct.
- Type: any
Any object.
import { SimpleNAT } from 'cdk-construct-simple-nat'
SimpleNAT.isOwnedResource(construct: IConstruct)
Returns true if the construct was created by CDK, and false otherwise.
- Type: constructs.IConstruct
import { SimpleNAT } from 'cdk-construct-simple-nat'
SimpleNAT.isResource(construct: IConstruct)
Check whether the given construct is a Resource.
- Type: constructs.IConstruct
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. |
public readonly node: Node;
- Type: constructs.Node
The tree node.
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.
public readonly stack: Stack;
- Type: aws-cdk-lib.Stack
The stack in which this resource is defined.
Name | Type | Description |
---|---|---|
Ipv6Regex |
string |
No description. |
public readonly Ipv6Regex: string;
- Type: string
Properties for how adding IPs to route.
import { RouteProps } from 'cdk-construct-simple-nat'
const routeProps: RouteProps = { ... }
Name | Type | Description |
---|---|---|
excludeIPv6 |
boolean |
If excluding IPv6 when creating route. |
public readonly excludeIPv6: boolean;
- Type: boolean
- Default: false
If excluding IPv6 when creating route.
Properties for NAT instances.
import { SimpleNATProps } from 'cdk-construct-simple-nat'
const simpleNATProps: SimpleNATProps = { ... }
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. |
public readonly vpc: IVpc;
- Type: aws-cdk-lib.aws_ec2.IVpc
The VPC the NAT instances will reside.
public readonly customScripts: string;
- Type: string
- Default: no custom script.
The custom script when provisioning the NAT instances.
public readonly instanceType: InstanceType;
- Type: aws-cdk-lib.aws_ec2.InstanceType
- Default: t3.MICRO.
The instance type of NAT instances.
public readonly keyName: string;
- Type: string
- Default: No SSH access will be possible.
The key name of ssh key of NAT instances.
public readonly machineImage: IMachineImage;
- Type: aws-cdk-lib.aws_ec2.IMachineImage
- Default: Amazon Linux 2 for x86_64.
The AMI of NAT instances.
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
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.
public readonly role: IRole;
- Type: aws-cdk-lib.aws_iam.IRole
- Default: an IAM role is created.
The IAM role attached to NAT instances.