skip to Main Content

AWS has a limit of 5 Elastic IP, and I have already reach that limit … so I can’t deploy the infra of a new application (ecs service + rds cluster), and the only way that I know to give internet access to a load balancer is an Internet Gateway with a Elastic IP and I don’t want to change my zone (us-east) … I’m new to infra related stuff, and I’m deploying this infra with terraform, but I get the error nvalidSubnet: VPC vpc-04dbc354551b94dce has no internet gateway cause I don’t have an internet gateway for that load balancer … any ideas?

2

Answers


  1. and the only way that I know to give internet access to a load balancer is an Internet Gateway with a Elastic IP

    You can’t assign an Elastic IP to an Internet Gateway, so your statement regarding the need to do that makes no sense.
    Perhaps you are thinking about NAT Gateways, which you can assign Elastic IPs to, but NAT Gateways are for outbound traffic only, and are not used by load balancers at all.

    To make a load balancer accessible from the Internet, you need to place them in a subnet (or subnets) with routes to an Internet Gateway (these are called public subnets),
    and you need to select the "public" scheme for the load balancer. That’s it. There is no Elastic IP involved in this at all. And the default scheme is "public" so unless you manually changed it to "internal" it should already be public.

    If you are wanting your load balancer to have a static (unchanging) public IP address, then you would have to use a Network Load Balancer, and assign an Elastic IP directly
    to the load balancer. But this is not required to make the load balancer accessible from the Internet. It is just required if you want to address the load balancer via an IP
    address instead of a DNS name.


    I’m deploying this infra with terraform, but I get the error invalidSubnet: VPC vpc-04dbc354551b94dce has no internet gateway cause I don’t have an internet gateway for that load balancer

    Just add an Internet gateway to your VPC. There is no Elastic IP address involved in order to do this. Note in the Terraform code example all you have to provide is a VPC ID to create the Internet Gateway.


    If you are new to AWS VPCs and infrastructure stuff in general, I recommend using the official AWS VPC Terraform module which will create a working VPC for you with just a few parameters you have to configure on your part.

    Login or Signup to reply.
  2. Request more Elastic IP’s on Service Quotas if you need.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search