Do Internal ALBs have static IPs?
No, but there is a workaround at the bottom.
So I got this question not long ago, and I realized I could not say with 100% certainty if it is true or false. I asked some friends, also working daily with AWS, and it seems many think that Internal ALBs have static IPs.
I Googled and read the documentation, but I could not find anything obvious to confirm or deny this.
So I decided I have to do some testing. Since I know that Public Elastic Load Balancers scale up and down based on the load, I figured I could test this with a rather simple setup.
I set up a test environment using this Cloudformation Template: https://github.com/hasselrot/cloudformation/blob/master/INTERNAL-ALB-ASG/01-demo-internal-alb-asg.yaml
This sets up an autoscaling group of Amazon Linux Servers, installs Apache Web Server on them and adds them to a Private ALB.
Logged on to one of my test servers, I get the current IP addresses of the ALB and also verify that it responds to my http-requests:
I then proceed to do some load testing using Apache Benchmark:
And when I check the DNS name again, the IP addresses have changed:
No, you can not count on an Internal Application LoadBalancer to have a static IP.
After doing some deeper digging, I found this in the documentation:
“As traffic to your application changes over time, Elastic Load Balancing scales your load balancer and updates the DNS entry. Note that the DNS entry also specifies the time-to-live (TTL) as 60 seconds, which ensures that the IP addresses can be remapped quickly in response to changing traffic.” (https://docs.aws.amazon.com/elasticloadbalancing/latest/userguide/how-elastic-load-balancing-works.html )
Now it does not specifically mention public or internal loadbalancers, but one could assume it then applies to both.
So then what?
Well there is a workaround, if you require static IPs. You can use a combination of a Network LoadBalancer (which can have an Static IP) and a Lambda function that keeps it updated as the ALB IP addresses change.