[我们正在尝试使用aws ecs cli的create-service命令创建具有指定任务定义的服务。我们的任务定义是people-cloud:27。
aws ecs create-service --cluster cloud1 --service-name docker-service --task-definition people-cloud:27
--load-balancers targetGroupArn=arn:aws:elasticloadbalancing:ap-south-1:2******5555:targetgroup/ecsCloud/ee7f4c280b1672aa,containerName=app,containerPort=8080,targetGroupArn=arn:aws:elasticloadbalancing:ap-south-1:2******5555:targetgroup/ecsServer/54fcbf7052957660,containerName=app2,containerPort=2990
--launch-type FARGATE --client-token AMOEBA@123 --desired-count 1 --network-configuration "awsvpcConfiguration={subnets=[subnet-0e11****f9e4218,subnet-0er****ufgrger],securityGroups=[sg-******5b***b3]}"
该命令提到它可以将多个负载均衡器作为输入,但是当我们以逗号分隔的格式提供它们时,仅考虑最后一个。
在这种情况下,输出中仅发布附加到app2容器的容器。需要有关如何在cli命令中提供多个负载均衡器信息的帮助。
请尝试不添加逗号。文档说--load-balancers
是list
的一种]
aws ecs create-service --cluster cloud1 --service-name docker-service --task-definition people-cloud:27 --load-balancers targetGroupArn=arn:aws:elasticloadbalancing:ap-south-1:2******5555:targetgroup/ecsCloud/ee7f4c280b1672aa,containerName=app,containerPort=8080 targetGroupArn=arn:aws:elasticloadbalancing:ap-south-1:2******5555:targetgroup/ecsServer/54fcbf7052957660,containerName=app2,containerPort=2990 --launch-type FARGATE --client-token AMOEBA@123 --desired-count 1 --network-configuration "awsvpcConfiguration={subnets=[subnet-0e11****f9e4218,subnet-0er****ufgrger],securityGroups=[sg-******5b***b3]}"
FYI:请参阅registering multiple target groups上的文档