3

ELB: Elastic Load Balancer ALB: Application Load Balancer

I am trying to map elb/alb on aws to another elb (ex: http://my-elb-domain.com),

elb/alb -> elb

in alb: I didn't find a way to register elb as targets. in elb: only maps to instances

zillani
  • 1,070
  • 3
  • 18
  • 26

3 Answers3

6

This is not possible.

Both the Classic Load Balancer and Target Groups for the Application Load Balancer only accept Amazon EC2 instances as targets.

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
  • Would be nice if you could link to where this is stated. Also, you mention in your comment on the question that "there might be alternatives". It would be much appreciated if you could expound a bit on what these might be, in your answer? – Steen Jun 17 '19 at 11:26
  • 1
    @steen It is hard to link to documentation that proves something is _not_ possible, but here's something close: [Target Groups for Your Application Load Balancers - Elastic Load Balancing](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/load-balancer-target-groups.html) Application Load Balancers can now also send traffic to **AWS Lambda functions**. As to the alternatives, it would depend upon what the OP was actually trying to accomplish, but they never gave any further information. – John Rotenstein Jun 17 '19 at 12:13
3

Explanation

We have found a roundabout way to accomplish this via the AWS CLI, and are currently using it in production to route traffic. Note that the solution below ends up routing to the same instances behind an ELB, but not through the ELB itself. Here's how it works:

  1. When created an elastic beanstalk environment comes with an automatically generated autoscaling group
  2. An auto-scaling group can be attached to up to 10 target groups via the CLI
  3. That target group can be the direct target of an ALB

Visual Flow

Traffic -> ALB -> Target Group -> Autoscaling Group -> Same Instances ELB Points To

Setup Instructions

  1. Create an Elastic Beanstalk application
  2. Get the name of the Autoscaling group generated for the Elastic Beanstalk app
  3. Create a target group (with no targets), save the ARN for the target group.
  4. Create your ALB, setting its target to the target group create in step #3
  5. Attach the target group to your Autoscaling group via the AWS CLI

    aws autoscaling attach-load-balancer-target-groups --auto-scaling-group-name {AutoScalingGroupName} --target-group-arns {TargetGroupARN}

Daymon Schroeder
  • 682
  • 1
  • 4
  • 23
  • Daymon, have you encountered issues with server upgrades? Or does your command line "attaching" to the autoscaling group avoid this? See: https://serverfault.com/questions/1000783/application-load-balancer-with-aws-elastic-beanstalk-target-group – Ben in CA Jan 28 '20 at 17:31
2

No. You can't map one ELB to another ELB directly.

Manoj
  • 2,314
  • 2
  • 21
  • 36