zxkane.cdk-construct-simple-nat


Namezxkane.cdk-construct-simple-nat JSON
Version 0.2.714 PyPI version JSON
download
home_pagehttps://github.com/zxkane/snat
SummaryA CDK construct to build Simple NAT instance on AWS.
upload_time2024-04-22 00:17:55
maintainerNone
docs_urlNone
authorKane Zhu<me@kane.mx>
requires_python~=3.8
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Simple NAT

![Release](https://github.com/zxkane/snat/workflows/Release/badge.svg)
[![NPM version](http://img.shields.io/npm/v/cdk-construct-simple-nat.svg?style=flat-square)](https://www.npmjs.com/package/cdk-construct-simple-nat)
[![pypi version](http://img.shields.io/pypi/v/zxkane.cdk-construct-simple-nat.svg?style=flat-square)](https://pypi.org/project/zxkane.cdk-construct-simple-nat/)
![coverage](https://img.shields.io/codecov/c/github/zxkane/snat?style=flat-square)

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](arch.png)

## Install

TypeScript/JavaScript:

```shell
yarn add cdk-construct-simple-nat
```

or

```shell
npm install cdk-construct-simple-nat
```

## Usage

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

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

See the complete [example](example/) and [API doc](./API.md).

## FAQ

### What's the difference between [EC2 NAT instances](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-ec2-readme.html#using-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](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-ec2-readme.html#using-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](https://docs.aws.amazon.com/vpc/latest/userguide/amazon-vpc-limits.html#vpc-limits-route-tables), 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,

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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/zxkane/snat",
    "name": "zxkane.cdk-construct-simple-nat",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "~=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "Kane Zhu<me@kane.mx>",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/25/eb/c0ef04b130964e8d9acbf468e39e5b966cc9ce2151ffac3593860059d1fd/zxkane.cdk-construct-simple-nat-0.2.714.tar.gz",
    "platform": null,
    "description": "# Simple NAT\n\n![Release](https://github.com/zxkane/snat/workflows/Release/badge.svg)\n[![NPM version](http://img.shields.io/npm/v/cdk-construct-simple-nat.svg?style=flat-square)](https://www.npmjs.com/package/cdk-construct-simple-nat)\n[![pypi version](http://img.shields.io/pypi/v/zxkane.cdk-construct-simple-nat.svg?style=flat-square)](https://pypi.org/project/zxkane.cdk-construct-simple-nat/)\n![coverage](https://img.shields.io/codecov/c/github/zxkane/snat?style=flat-square)\n\nIt's a CDK construct to create NAT instances on AWS.\n\nIt supports adding specific IP CIDRs to route tables of VPC, the network traffic to those IP CIDRs will be forwarded to the NAT instances.\n\nIt supports routing to below services out of box,\n\n* Github git servers\n* Google\n* Cloudflare\n\n![Arch diagram](arch.png)\n\n## Install\n\nTypeScript/JavaScript:\n\n```shell\nyarn add cdk-construct-simple-nat\n```\n\nor\n\n```shell\nnpm install cdk-construct-simple-nat\n```\n\n## Usage\n\n```python\nimport { SimpleNAT } from 'cdk-construct-simple-nat';\n\nnew SimpleNAT(this, 'SimpleNAT', {\n  vpc,\n  natSubnetsSelection: {\n    subnetType: SubnetType.PUBLIC,\n    onePerAz: true,\n  },\n})\n.withGithubRoute();\n```\n\nSee the complete [example](example/) and [API doc](./API.md).\n\n## FAQ\n\n### What's the difference between [EC2 NAT instances](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-ec2-readme.html#using-nat-instances) and NAT instances created by this construct\n\nThere are below differences,\n\n* EC2 NAT instance will route all Internet traffic to itself by default\n* NAT instance uses depracated Amazon Linux AMI, this construct always uses latest Amazon Linux 2 AMI\n* NAT instances created by this construct can work with NAT gateways together, you can have multiple NAT instances in one VPC\n* This construct can help when only routing specific traffic(for example, github/gist) to NAT instances which acts as transit proxy\n\n### What's the difference between [CDK built-in NAT instances](https://docs.aws.amazon.com/cdk/api/latest/docs/aws-ec2-readme.html#using-nat-instances) and NAT instances created by this construct\n\n* CDK built-in NAT instances has to be created with VPC stack, this construct can add NAT instances to any existing VPC\n* You can use this construct multiple NAT instances for different purposes\n* This construct allows you customize the instances how to route the traffic\n\n### The deployment fails due to the routes in route table exceeds the limit\n\n[The default routes in route table is 50](https://docs.aws.amazon.com/vpc/latest/userguide/amazon-vpc-limits.html#vpc-limits-route-tables), the deployment will fail if adding routes more than the limit of your account.\nYou can increase the limit up to **1000** routes per route table via service quota.\n\n### How to exclude IPv6 CIDR with built-in github/google/cloudflare routes\n\nYou can exclude IPv6 CIDR like below,\n\n```python\nnew SimpleNAT(this, 'SimpleNAT', {\n  vpc,\n})\n.withCloudflareRoute({\n  excludeIPv6: true,\n});\n```\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "A CDK construct to build Simple NAT instance on AWS.",
    "version": "0.2.714",
    "project_urls": {
        "Homepage": "https://github.com/zxkane/snat",
        "Source": "https://github.com/zxkane/snat"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "976694ecd20e95dd058d81e1102547bfd4e7540becfb580db7f963b44844e9be",
                "md5": "d17eda38e25d68eff60678b45b4810fa",
                "sha256": "cc8423a00c83d175828f216798ad25277989aef88a0f4ff2351a061801c60b8b"
            },
            "downloads": -1,
            "filename": "zxkane.cdk_construct_simple_nat-0.2.714-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d17eda38e25d68eff60678b45b4810fa",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "~=3.8",
            "size": 253992,
            "upload_time": "2024-04-22T00:17:50",
            "upload_time_iso_8601": "2024-04-22T00:17:50.075621Z",
            "url": "https://files.pythonhosted.org/packages/97/66/94ecd20e95dd058d81e1102547bfd4e7540becfb580db7f963b44844e9be/zxkane.cdk_construct_simple_nat-0.2.714-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "25ebc0ef04b130964e8d9acbf468e39e5b966cc9ce2151ffac3593860059d1fd",
                "md5": "54f2ac4af30e486f1d40f863a3c7b913",
                "sha256": "0cf064917c761fb61eff3ecfc9cb307059e27c5a151012e0b2a29f0afd39048a"
            },
            "downloads": -1,
            "filename": "zxkane.cdk-construct-simple-nat-0.2.714.tar.gz",
            "has_sig": false,
            "md5_digest": "54f2ac4af30e486f1d40f863a3c7b913",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "~=3.8",
            "size": 255108,
            "upload_time": "2024-04-22T00:17:55",
            "upload_time_iso_8601": "2024-04-22T00:17:55.187072Z",
            "url": "https://files.pythonhosted.org/packages/25/eb/c0ef04b130964e8d9acbf468e39e5b966cc9ce2151ffac3593860059d1fd/zxkane.cdk-construct-simple-nat-0.2.714.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-22 00:17:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "zxkane",
    "github_project": "snat",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "zxkane.cdk-construct-simple-nat"
}
        
Elapsed time: 0.25437s