I am new to AWS and web development in general. I have React JS and Spring Boot website and am trying to attach Elastic IPs to my application load balancers using terraform. I am unable to figure out as how to get an elastic IP and then attach it to my load balancers. As I have two services in my cluster would I need two separate elastic IPs or would one do? How do we attach those IPs to the load balancers in terraform?
Asked
Active
Viewed 1,282 times
0

Yogeshwar Chaturvedi
- 651
- 1
- 4
- 9
-
3Why do you want to have a static IP address for your load balancer? If you do need this then unfortunately you can't use an application load balancer and instead will need to use a network load balancer because ALBs don't support using elastic IP addresses. – ydaetskcoR Aug 27 '21 at 11:22
-
@ydaetskcoR Whenever I am reconfiguring the ALB, its DNS name is changing and I need to get SSL certificates for those DNS but I'm not able to do so because of dynamic DNS name. – Yogeshwar Chaturvedi Aug 27 '21 at 11:24
-
3A static IP address won't help you there because you can't get an SSL certificate for an IP address. You need to create a DNS record that points to the ALB instead. The [`aws_route53_record` resource documentation has an example of creating an alias record that points at an ELBv1](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_record#alias-record) that you should be able to adapt to point to an ALB instead. – ydaetskcoR Aug 27 '21 at 11:28
-
1As for how a single load balancer sends traffic to multiple services that's a whole separate question that needs a separate answer. I'd encourage you to ask one question that asks how that is done (simplify as much as possible with eg HTTP only to a default DNS ALB) and then you can ask another question about how you get SSL certificates for that ALB that will work for both of those services and link back to that first question for context. – ydaetskcoR Aug 27 '21 at 11:30
-
As other's said, you can't use EIP. You can get AWS accelerator instead. – Marcin Aug 27 '21 at 23:23