You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 3, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: Readme.md
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -155,12 +155,16 @@ traffic in and out of the different subnets. The Stack terraform will automatica
155
155
156
156
Traffic from each internal subnet to the outside world will run through the associated NAT gateway.
157
157
158
+
Alternatively, setting the `use_nat_instances` VPC module variable to true, will use [EC2 NAT instances][nat-instances] instead of the NAT gateway. NAT instances cost less than the NAT gateway, can be shutdown when not in use, and may be preferred in development environments. By default, NAT instances will not use [Elastic IPs][elastic-ip] to avoid a small hourly charge if the NAT instances are not running full time. To use Elastic IPs for the NAT instances, set the `use_eip_with_nat_instances` VPC module variable to true.
Copy file name to clipboardExpand all lines: docs.md
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -44,6 +44,10 @@ Usage:
44
44
| cidr | the CIDR block to provision for the VPC, if set to something other than the default, both internal_subnets and external_subnets have to be defined as well |`10.30.0.0/16`| no |
45
45
| internal_subnets | a list of CIDRs for internal subnets in your VPC, must be set if the cidr variable is defined, needs to have as many elements as there are availability zones |`<list>`| no |
46
46
| external_subnets | a list of CIDRs for external subnets in your VPC, must be set if the cidr variable is defined, needs to have as many elements as there are availability zones |`<list>`| no |
47
+
| use_nat_instances | use NAT EC2 instances instead of the NAT gateway service |`false`| no |
48
+
| use_eip_with_nat_instances | use Elastic IPs with NAT instances if `use_nat_instances` is true |`false`| no |
49
+
| nat_instance_type | the EC2 instance type for NAT instances if `use_nat_instances` is true |`t2.nano`| no |
50
+
| nat_instance_ssh_key_name | the name of the ssh key to use with NAT instances if `use_nat_instances` is true | "" | no |
47
51
| availability_zones | a comma-separated list of availability zones, defaults to all AZ of the region, if set to something other than the defaults, both internal_subnets and external_subnets have to be defined as well |`<list>`| no |
48
52
| bastion_instance_type | Instance type for the bastion |`t2.micro`| no |
49
53
| ecs_cluster_name | the name of the cluster, if not specified the variable name will be used | `` | no |
Copy file name to clipboardExpand all lines: vpc/main.tf
+129-4Lines changed: 129 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,41 @@ variable "name" {
26
26
default="stack"
27
27
}
28
28
29
+
variable"use_nat_instances" {
30
+
description="If true, use EC2 NAT instances instead of the AWS NAT gateway service."
31
+
default=false
32
+
}
33
+
34
+
variable"nat_instance_type" {
35
+
description="Only if use_nat_instances is true, which EC2 instance type to use for the NAT instances."
36
+
default="t2.nano"
37
+
}
38
+
39
+
variable"use_eip_with_nat_instances" {
40
+
description="Only if use_nat_instances is true, whether to assign Elastic IPs to the NAT instances. IF this is set to false, NAT instances use dynamically assigned IPs."
41
+
default=false
42
+
}
43
+
44
+
# This data source returns the newest Amazon NAT instance AMI
45
+
data"aws_ami""nat_ami" {
46
+
most_recent=true
47
+
48
+
filter {
49
+
name="owner-alias"
50
+
values=["amazon"]
51
+
}
52
+
53
+
filter {
54
+
name="name"
55
+
values=["amzn-ami-vpc-nat*"]
56
+
}
57
+
}
58
+
59
+
variable"nat_instance_ssh_key_name" {
60
+
description="Only if use_nat_instance is true, the optional SSH key-pair to assign to NAT instances."
0 commit comments