简体   繁体   English

使用 CloudFormation 在 ECS 服务上定义多个任务

[英]Multiple Tasks Definition on ECS Service using CloudFormation

Hi I'm newbie on CloudFormation AWS, and I'm working right now with a ECS Service with 1 task, but I would like to put more tasks using CloudFormation.嗨,我是 CloudFormation AWS 的新手,我现在正在使用具有 1 个任务的 ECS 服务,但我想使用 CloudFormation 完成更多任务。 However inside the properties on AWS ECS Service, there's one called Task Definition, and only allows to put 1 tasks.然而,在 AWS ECS 服务的属性中,有一个称为任务定义,并且只允许放置 1 个任务。 How can I configure in order to use more tasks.如何配置以使用更多任务。 I´m doing the project on the same Region.我正在同一个地区做这个项目。 Thanks谢谢

Task Definition Property任务定义属性

Sadly, you can't do this.可悲的是,你不能这样做。 A single service can run multiple copies of only one task .单个服务只能运行一个任务的多个副本。 So if you want to run multiple tasks, you have to create multiple services , ie, one service per task.因此,如果要运行多个任务,则必须创建多个服务,即每个任务一个服务。

However, a single task can contain multiple containers.但是,单个任务可以包含多个容器。

I've already got it.我已经拿到了。 There's other parameter called DesiredCount, and it's gonna make x replicas, depending the number of tasks you need.还有一个名为 DesiredCount 的参数,它会生成 x 个副本,具体取决于您需要的任务数量。 So if you want to put 5 tasks in your service, DesiredCount parameter that you have to put is 5. Here is the link if you want to search the parameter DesiredCount for more info.因此,如果您想在您的服务中放入 5 个任务,您必须放入的 DesiredCount 参数为 5。如果您想搜索参数DesiredCount以获取更多信息,请点击此处的链接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM