{"id":26718635,"url":"https://github.com/hamdiz0/terraform-aws-hz-nat-instance","last_synced_at":"2026-04-28T23:01:44.068Z","repository":{"id":284121880,"uuid":"953891058","full_name":"hamdiz0/terraform-aws-hz-nat-instance","owner":"hamdiz0","description":"A Terraform module for deploying high available NAT_Instances.  Leave a Star !!!","archived":false,"fork":false,"pushed_at":"2025-03-29T05:51:50.000Z","size":10,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-12T09:08:13.146Z","etag":null,"topics":["aws","nat-instances","terraform","terraform-module"],"latest_commit_sha":null,"homepage":"https://registry.terraform.io/modules/hamdiz0/hz-nat-instance/aws/latest","language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hamdiz0.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"security_group.tf","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-03-24T08:44:01.000Z","updated_at":"2026-01-28T22:48:17.000Z","dependencies_parsed_at":"2025-03-24T09:40:22.351Z","dependency_job_id":"dae5429e-18a8-4946-9319-d1d853ce7676","html_url":"https://github.com/hamdiz0/terraform-aws-hz-nat-instance","commit_stats":null,"previous_names":["hamdiz0/terraform-aws-hz-nat","hamdiz0/terraform-aws-hz-nat-instance"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/hamdiz0/terraform-aws-hz-nat-instance","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hamdiz0%2Fterraform-aws-hz-nat-instance","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hamdiz0%2Fterraform-aws-hz-nat-instance/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hamdiz0%2Fterraform-aws-hz-nat-instance/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hamdiz0%2Fterraform-aws-hz-nat-instance/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hamdiz0","download_url":"https://codeload.github.com/hamdiz0/terraform-aws-hz-nat-instance/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hamdiz0%2Fterraform-aws-hz-nat-instance/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32279655,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-25T18:29:39.964Z","status":"ssl_error","status_checked_at":"2026-04-25T18:29:32.149Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","nat-instances","terraform","terraform-module"],"created_at":"2025-03-27T17:35:34.678Z","updated_at":"2026-04-25T22:33:25.687Z","avatar_url":"https://github.com/hamdiz0.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hz-NAT\n\n#### A Terraform module to create a basic `NAT_Instance` setup on aws.\n##### The module creates a `Network Interface` and an `Auto Scaling Group` based on the specified `Public Subnet` in the inputs.\n##### The ASG will spin up a single `NAT Instance` in the specified Public Subnet using a `Launch Template`.\n##### The `Launch Template` attaches the `Network Interface` to the instance and uses a `user data` script to configure the `NAT Instance`.\n##### The script is based on the official AWS [Create a NAT AMI](https://docs.aws.amazon.com/vpc/latest/userguide/work-with-nat-instances.html#create-nat-ami).\n##### This module doesn't use a custom AMI, rather it executes the NAT configuration on launch of the instance using the default `Amazon Linux 2023 AMI` . while the execution doesn't take long, it is preferable to use a custom AMI.\n\n#### Inputs:\n- `ami_id`: The ID of the AMI to use for the NAT instance. Default is the Amazon Linux 2023 AMI. (optional)\n- `instance_type`: The instance type to use for the NAT instance. Default is `t4g.micro`. (optional)\n- `use_ssh`: Whether to allow SSH access to the NAT instance. Default is `false`. (optional)\n- `key_name`: The key pair to use for the NAT instance. (optional)\n- `use_script`: Whether to use the user data script to configure the NAT instance. Default is `true`. (optional)\n- `vpc_id`: The ID of the VPC to create the NAT instance in. (required)\n- `map_subnet_rtbs`: A list of pairs where the first element is a public subnet ID and the second element is a list of private route table IDs. (required)\n\n### Usage:\n#### basic:\n```hcl\nmodule \"hz-NAT\" {\n  source        = \"hamdiz0/hz-nat-instance/aws\"\n  instance_type = \"t4g.micro\"\n  vpc_id        = aws_vpc.vpc.id\n  map_subnet_rtbs = [\n    ([ # ( public subnet id , [private route tables ids] ) \n      public-subnet-id, [private_rtb_1_id, private_rtb_2_id , ...]\n    ])\n  ]\n}   \n```\n#### cross-az-optimized:\n##### The module doesn't have a built in cross az optimization, rather it is up to the user to provide the necessary inputs or modify the network configuration to achieve optimal solution.\n##### if cross az data transfer is concern , you may want to deploy multiple NAT instances in different AZs.\n##### make sure to create a public subnet in each AZ and provide the private route tables ids associated with subnets on that same AZ.\n##### also make sure not to specify a route table multiple times to avoid confilcts.\n```hcl\nmodule \"hz-NAT\" {\n  source        = \"hamdiz0/hz-nat-instance/aws\"\n  instance_type = \"t4g.micro\"\n  vpc_id        = aws_vpc.vpc.id\n  map_subnet_rtbs = [\n    ([ # ( public subnet id , [private route tables ids] )\n      public-subnet-id-az1, [private_rtb_1_id-az1, private_rtb_2_az1]\n    ]),\n    ([\n      public-subnet-id-az2, [private_rtb_3_id-az2]\n    ]),\n    ([\n      public-subnet-id-az3, [private_rtb_4_id-az3]\n    ])\n  ]\n}   \n```\n\n### Outputs:\n- `nat_instance_public_ips`: A list of NAT instance public IPs along with their availability zones.\n- `eni_rtb_pairs`: A list of pairs where each pair contains a private route table ID and its associated ENI ID.\n- `ami_id`: The ID of the AMI used for the NAT instance.\n- `instance_type`: The instance type of the NAT instance.\n- `eni_arns`: A list of ENI ARNs associated with the NAT instance.\n- `eni_ids`: A list of ENI IDs associated with the NAT instance.\n- `asg_arns`: A list of ARNs for the Auto Scaling Groups managing NAT instances.\n- `asg_ids`: A list of IDs for the Auto Scaling Groups managing NAT instances.\n- `NAT_security_group_id`: The security group ID assigned to the NAT instance.\n- `NAT_security_group_arn`: The security group ARN assigned to the NAT instance.\n\n### This module is pretty basic, do not hesitate to seggest improvments and contribute.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhamdiz0%2Fterraform-aws-hz-nat-instance","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhamdiz0%2Fterraform-aws-hz-nat-instance","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhamdiz0%2Fterraform-aws-hz-nat-instance/lists"}