terraform-aws-modules / terraform-aws-vpc

Terraform module to create AWS VPC resources πŸ‡ΊπŸ‡¦
https://registry.terraform.io/modules/terraform-aws-modules/vpc/aws
Apache License 2.0
2.96k stars 4.41k forks source link

Allow to disable elastic IPs if they are unused #967

Closed jigarzon closed 1 year ago

jigarzon commented 1 year ago

Is your request related to a problem? Please describe.

The module creates an Elastic IP as part of the VPC. I don't clearly understand the reasons, seems to be associated with conserving it across creations / destructions.

AWS charges a value when Elastic IPs are created and not associated with any service.

My basic understanding of this, suggests that in some circumstances (like mine, in which I'm not directly exposing services, only using API gateway), that charge doesn't make sense.

Describe the solution you'd like.

Allow to disable elastic IPs

bryantbiggs commented 1 year ago

Elastic IPs are only used on the NAT gateways

jigarzon commented 1 year ago

I still need NAT for outbound access to internet. But Elastic IPs, if I'm not misunderstanding this, are used for maintaining public IP addresses for inbound accessing our network

bryantbiggs commented 1 year ago

No, they are required when used to NAT to the public internet https://docs.aws.amazon.com/vpc/latest/userguide/vpc-nat-gateway.html

Public – (Default) Instances in private subnets can connect to the internet through a public NAT gateway, but cannot receive unsolicited inbound connections from the internet. You create a public NAT gateway in a public subnet and must associate an elastic IP address with the NAT gateway at creation. You route traffic from the NAT gateway to the internet gateway for the VPC. Alternatively, you can use a public NAT gateway to connect to other VPCs or your on-premises network. In this case, you route traffic from the NAT gateway through a transit gateway or a virtual private gateway.

github-actions[bot] commented 1 year ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.