Skip to main content

A CDK construct to build Simple NAT instance on AWS.

Project description

Simple NAT

Release NPM version pypi version coverage

It's a CDK construct to create NAT instances on AWS.

It supports adding specific IP CIDRs to route tables of VPC, the network traffic to those IP CIDRs will be forwarded to the NAT instances.

It supports routing to below services out of box,

  • Github git servers
  • Google
  • Cloudflare

Arch diagram

Install

TypeScript/JavaScript:

yarn add cdk-construct-simple-nat

or

npm install cdk-construct-simple-nat

Usage

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

new SimpleNAT(this, 'SimpleNAT', {
  vpc,
  natSubnetsSelection: {
    subnetType: SubnetType.PUBLIC,
    onePerAz: true,
  },
})
.withGithubRoute();

See the complete example and API doc.

FAQ

What's the difference between EC2 NAT instances and NAT instances created by this construct

There are below differences,

  • EC2 NAT instance will route all Internet traffic to itself by default
  • NAT instance uses depracated Amazon Linux AMI, this construct always uses latest Amazon Linux 2 AMI
  • NAT instances created by this construct can work with NAT gateways together, you can have multiple NAT instances in one VPC
  • This construct can help when only routing specific traffic(for example, github/gist) to NAT instances which acts as transit proxy

What's the difference between CDK built-in NAT instances and NAT instances created by this construct

  • CDK built-in NAT instances has to be created with VPC stack, this construct can add NAT instances to any existing VPC
  • You can use this construct multiple NAT instances for different purposes
  • This construct allows you customize the instances how to route the traffic

The deployment fails due to the routes in route table exceeds the limit

The default routes in route table is 50, the deployment will fail if adding routes more than the limit of your account. You can increase the limit up to 1000 routes per route table via service quota.

How to exclude IPv6 CIDR with built-in github/google/cloudflare routes

You can exclude IPv6 CIDR like below,

new SimpleNAT(this, 'SimpleNAT', {
  vpc,
})
.withCloudflareRoute({
  excludeIPv6: true,
});

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zxkane.cdk-construct-simple-nat-0.2.222.tar.gz (254.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file zxkane.cdk-construct-simple-nat-0.2.222.tar.gz.

File metadata

File hashes

Hashes for zxkane.cdk-construct-simple-nat-0.2.222.tar.gz
Algorithm Hash digest
SHA256 dbba47fe25dcad6635c4cd2c7260d0fb00ae5d049ce8d8b7876253d116480773
MD5 bfc10b6d267b96f8cf7f5097f58d60ec
BLAKE2b-256 1e95ece6db011465e28f0fd94a4d4cefc5bb36f3f71e6adc6e49b0080c2ad22d

See more details on using hashes here.

File details

Details for the file zxkane.cdk_construct_simple_nat-0.2.222-py3-none-any.whl.

File metadata

File hashes

Hashes for zxkane.cdk_construct_simple_nat-0.2.222-py3-none-any.whl
Algorithm Hash digest
SHA256 1e8fee3ebc40e788b5a2527d69e7d7f9de7ebfa41f1debcfc5941807526ba873
MD5 30695a8e4a0c5f2aaac35bad1c120a79
BLAKE2b-256 8276e173ad351e8a128ce48e9122dea849a2d3151451b9affb7c51daa1d1f25f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page