0

I would like to create an ELB the spans three subnets and then to somehow configure three listeners that will forward ELB traffic to only instances on each subnet. Is there a way to do this without layering ELBs (1 ELB -> 3 subnet specific ELBs -> instances)?

To be more descriptive, I want 3 RabbitMQ clusters in 3 different subnets. Messages should be able to be arbitrarily published to any of the RMQ instances through an ELB. However, I would also like to be able to access the admin web consoles for each individual cluster through the ELB where the cluster is specified by using a different ELB port. In the [disfavored] multi-tier ELB configuration I described above, the main ELB would be used to publish messages and then the 3 subnet specific ELBs would be accessed when viewing the admin console.

Here is an example Terraform ELB resource that I'm currently using that has one listener that will forward to any instance in any of the subnets but I would like to have 3 listeners with 3 different lb_ports that forward to only instances on one of the 3 subnets:

resource "aws_elb" "rabbit-elb" {
  name = "${var.short_name}-rmq-elb"
  security_groups = ["${split(",", var.security_groups)}"]
  subnets = ["${split(",",var.rabbit_subnets)}"]
  instances = ["${aws_instance.rabbitmq.*.id}"]
  internal = "true"
  cross_zone_load_balancing = true

  listener {
    instance_port = "${var.elb_port_http}"
    instance_protocol = "http"
    lb_port = "${var.elb_lb_port_http}"
    lb_protocol = "http"
  }
}
4

0 回答 0