我正在寻找一种方法来将两个目标组附加到单个ECS服务,而在另一个我的容器中暴露了两个端口,但我只能将一个端口与我的服务映射到LB。
到目前为止,我能够创建一个新的侦听器和目标组,但是在目标组创建之后,我可以看到一切按预期进行,但目标组显示There are no targets registered to this target group。

下面是我的目标组和侦听器配置
target_group:
resource "aws_lb_target_group" "e_admin" {
name = "${var.env_prefix_name}-admin"
port = 5280
protocol = "HTTP"
vpc_id = "${aws_vpc.VPC.id}"
health_check {
path = "/admin"
healthy_threshold = 2
unhealthy_threshold = 10
port = 5280
timeout = 90
interval = 100
matcher = "401,200"
}
}侦听器:‘
resource "aws_lb_listener" "admin" {
load_balancer_arn = "${aws_lb.admin_lb.arn}"
port = "5280"
protocol = "HTTP"
default_action {
target_group_arn = "${aws_lb_target_group.e_admin.id}"
type = "forward"
}
}我的问题是如何添加ECS集群自动标度组,或者如何将ECS集群中运行的所有实例添加到这个目标组?
发布于 2019-07-19 16:22:16
与https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-load-balancing.html相适应,
每个服务有一个负载均衡器或目标组的限制。
如果要将自动标号组附加到目标组,请使用aws_autoscaling_attachment、attachment.html
resource "aws_autoscaling_attachment" "asg_attachment_bar" {
autoscaling_group_name = "${aws_autoscaling_group.your_asg.id}"
alb_target_group_arn = "${aws_alb_target_group.e_admin.arn}"
}https://stackoverflow.com/questions/57115182
复制相似问题