AWS: Assign an Elastic IP to an ELB using Global Accelerator
Have you ever needed to assign an Elastic (static) IP to an Elastic Load Balancer? Well, now, with AWS Global Accelerator it is possible.
What is AWS Global Accelerator?
AWS Global Accelerator is a networking service that sends your user’s traffic through Amazon Web Service’s global network infrastructure, improving your internet user performance by up to 60%.
With Global Accelerator, you are provided two global static customer facing IPs to simplify traffic management. On the back end, add or remove your AWS application origins, such as Network Load Balancers, Application Load Balancers, Elastic IPs, and EC2 Instances, without making user facing changes. To mitigate endpoint failure, Global Accelerator automatically re-routes your traffic to your nearest healthy available endpoint.
Why assign and EIP to an ELB?
The main reason for associating an EIP to any sort of Elastic Load Balancer whether an Application Load Balancer, Networking Load Balancer or even an EC2 instance is when defining a route rule in a subnet route table. This is useful when you want to direct traffic to the ALB through a specific target like a NAT Gateway for instance.
How to set it up
- Navigate to the Global Accelerator service:
2. Click “Create Accelerator”
3. Give your accelerator a name and click Next:
4. Define the Listeners by choosing the Ports and Protocol that you need. You can add multiple listeners. Click Next
5. Define your Endpoint Group, you can have multiple groups for different Load Balancers, EC2 instances or Elastic IP’s. Click Next
6. Add endpoints. When choosing Application Load Balancer the Endpoint drop down will be automatically populated. Select your ALB, click Create accelerator and you are done
The accelerator takes a few minutes to be created. Once deployed you will see the Deployed status and the Static IP addresses. You now have 2 Elastic IP addresses that you can use to reach your ALB.