Skip to content

Assign predictable DNS Name or IP address to ALB

0

Hi, When creating an ALB (Application Load Balancer) is there an option to assign a static DNS Name? This is similar to another question "How can I assign a static IP address to an ALB?". However as far as I understand, an ALB provides you a DNS Name instead of an IP address.
That's ok. With a DNS name, you can use CNAME records to map to a consistent stable DNS Name.
The problem is in the following scenario: using EKS and kubernetes, you launch a cluster for testing. Then later, delete it. And repeat. Each time you repeat, and create new resources, the load balancers will have a new DNS name. That means you must adjust CNAME records.

I'm using aws-load-balancer-controller to create Ingresses, which in turn create load balancers. I would open an issue with aws-load-balancer-controller to see if we could add annotations, setting a DNS name.
However if the feature isn't available on ALBs, it won't be possible.

asked 10 months ago878 views
2 Answers
0

Unfortunately, there is no direct option to assign a static or custom DNS name to an Application Load Balancer (ALB) when creating it. ALBs are indeed assigned a default DNS name by AWS, which follows the format: name-id.elb.region.amazonaws.com. This DNS name is dynamically generated and changes each time you create a new ALB.

To address your scenario with EKS and Kubernetes where you're repeatedly creating and deleting clusters for testing, there are a couple of approaches you can consider:

  1. Use a custom domain name: Instead of relying on the ALB's default DNS name, you can create a custom domain name and associate it with your ALB. This way, you can keep your custom domain name consistent even when the underlying ALB changes. You would need to update the DNS record (preferably an alias record if using Route 53) each time you create a new ALB, but your application and external references can continue using the same custom domain.

  2. Use Amazon Route 53 with alias records: If you're using Route 53 as your DNS service, you can create an alias record that points to your ALB. Alias records have the advantage of being able to point directly to AWS resources like ALBs, and they're free of charge for AWS resource targets. You would still need to update this alias record when you recreate your ALB, but it provides a stable DNS name for your applications to use.

While it's not possible to set a static DNS name directly on the ALB, these approaches can help you maintain a consistent DNS name for your applications, even as the underlying ALB changes. As for opening an issue with aws-load-balancer-controller, while it's a good idea to suggest the feature, the core limitation is at the ALB level rather than the controller level.

Remember, ALBs are designed to be highly available and scalable, which is why they use DNS names that can resolve to multiple IP addresses behind the scenes, rather than static IP addresses or DNS names.
Sources
Application Load Balancers - Elastic Load Balancing
DNS record in Rouet53 for ALB | AWS re:Post
Configure a custom domain name for your Classic Load Balancer - Elastic Load Balancing

answered 10 months ago
EXPERT
reviewed 10 months ago
0

Thanks for the reply. I guess both of those answer 1. and 2. include "You would still need to update..." So something extra always needs to be done.

answered 10 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.