9

I can give a single instance an Elastic IP. No problem.

But I have an Elastic Beanstalk app. It can create and remove instances as needed. It has a load balancer. How can I get these features (Elastic IP and Elastic Beanstalk) to work together?

Ultimately, all I want to do is make calls to my server through my domain like this: mydomain.com/someApiCall and I don't want to worry about my Elastic IP becoming "detached."

Geoff Noble
  • 91
  • 1
  • 1
  • 2

3 Answers3

8

That is currently not possible and actually a limitation of the Elastic Load Balancing (ELB) in use, see e.g. Why does Amazon not allow assigning an Elastic IP to an Elastic Load Balancer?:

The elastic load balancer is simply a collection of individual software load balancers hosted within EC2, with DNS load balancing traffic among them. The pool can contain many IPs, at least one per availability zone, and depending on traffic levels.

D.Svanlunds's answer to Load balancers and elastic IP provides a good summary of why ELB is designed this way, and Shlomo Swidler's The “Elastic” in “Elastic Load Balancing”: ELB Elasticity and How to Test it provides an early but in-depth analysis of the ELB architecture and the implications for testing a web application in this context.


Update

Regarding your comment: You are communicating with your AWS Elastic Beanstalk application via the DNS name mapped to the Elastic Load Balancer, to which you can map a CNAME record in turn as usual, see Overview of Elastic Load Balancing:

Elastic Load Balancing automatically generates a DNS name for each load balancer. You can map any other domain name (such as www.example.com) to the automatically generated DNS name using CNAME or use an Amazon Route 53 alias for the load balancer's DNS name.

Further details can be found in Using Domain Names With Elastic Load Balancing, which describes how to associate your Elastic Load Balancing instance with a custom domain name — including subdomain names and the zone apex.

Steffen Opel
  • 5,560
  • 35
  • 55
  • How can I create an API with Beanstalk if I can't direct requests through the load balancer? How do I properly communicate with my Beanstalk app? – Geoff Noble Feb 18 '12 at 03:01
  • 1
    @GeoffNoble: I'm not sure I can follow, why should a call to example.com/resource provided by an API hosted on Elastic Beanstalk not work as expected? I've expanded my answer regarding _Using Domain Names With Elastic Load Balancing_ to hopefully clarify the underlying concept - good luck! – Steffen Opel Feb 23 '12 at 21:46
1

But I have an Elastic Beanstalk app. It can create and remove instances as needed. It has a load balancer. How can I get these features (Elastic IP and Elastic Beanstalk) to work together?

Starting with September 2017 you can use Network load balancer within beanstalk. It supports static IP addresses for the load balancer. You can also assign one Elastic IP address per subnet enabled for the load balancer.

ALex_hha
  • 7,025
  • 1
  • 23
  • 39
0

If you access your app through mydomain.com/someApiCall, the Elastic IP is not even in the picture. The ElasticBeanstalk gives you an url that looks like this:

http://myapp.elasticbeanstalk.com

you can just have your domain forward to myapp.elasticbeanstalk.com

Dexin Wang
  • 111
  • 1