Amazon web services AWS使用ECS服务注册多个目标组
我需要为一个ECS服务创建多个目标组。有人举过我如何通过AWS CLI或API做到这一点的例子吗? 由于这是一项最新的功能,我没有找到太多的示例。这是一个相对简单的示例,我没有机会在项目中测试它,但只是阅读文档,它看起来非常简单:只需在服务中添加多个负载平衡器(目标组)定义。例如,如果您正在使用,只需添加多个Amazon web services AWS使用ECS服务注册多个目标组,amazon-web-services,cloud,amazon-ecs,Amazon Web Services,Cloud,Amazon Ecs,我需要为一个ECS服务创建多个目标组。有人举过我如何通过AWS CLI或API做到这一点的例子吗? 由于这是一项最新的功能,我没有找到太多的示例。这是一个相对简单的示例,我没有机会在项目中测试它,但只是阅读文档,它看起来非常简单:只需在服务中添加多个负载平衡器(目标组)定义。例如,如果您正在使用,只需添加多个load\u balancer块: resource "aws_ecs_service" "my_service" { name = "my_service"
load\u balancer
块:
resource "aws_ecs_service" "my_service" {
name = "my_service"
cluster = "${aws_ecs_cluster.foo.id}"
task_definition = "${aws_ecs_task_definition.my_task.arn}"
... # other arguments
ordered_placement_strategy {
...
}
load_balancer {
target_group_arn = "${aws_lb_target_group.one.arn}"
container_name = "my_container_name"
container_port = 1234
}
load_balancer {
target_group_arn = "${aws_lb_target_group.two.arn}"
container_name = "my_container_name"
container_port = 4321
}
}