AWS ECS start multiple containers in one task definition

10,487

In your situation when you want to run multiple containers of different application. It is recommended to use a separate task definition for each one of them.

We use multiple containers in one task definition when we wanted to run some sort of sidecar with our application which is one of the containers of that task definition.

Also, In ECS you don't pay for task definition, You pay for AWS resources (e.g. EC2 instances or EBS volumes) you create to store and run your application. You only pay for what you use, as you use it; there are no minimum fees and no upfront commitments.

Pricing: https://aws.amazon.com/ecs/pricing/

Share:
10,487
Dipas
Author by

Dipas

Updated on June 24, 2022

Comments

  • Dipas
    Dipas almost 2 years

    I have docker container with one application, application runs based on input parameters, passed to entrypoint. I want to create one task definition for ECS and run multiple containers in parallel in one task definition with different input parameters for each container.

    The issue is - that I cannot do it without setting essential option to one of my containers in task definition. But, I do not want stop others, if my essential container finishes. All containers are independent.

    Possible option is to create one task definition per one container. But it will cost more, because my application doesn't use lot of resources.

    Is there any other solution or approach to run multiple containers in one task definition not rely on essential option?

  • Dipas
    Dipas over 5 years
    I'm using Fargate running option and I should predefine vCPU and Memory in task definition, before I launch my task. While it is running I pay for time I use and all resources I've already predifined for Fargate, but not for the resources I'm realy using in my task. So happens I have resources, which stand idle.
  • Satyamskillz IN
    Satyamskillz IN almost 3 years
    if I am using a code pipeline that runs one service from the ECS cluster then how we can run multiple tasks in one service? I am trying to run multiple containers in one task but it is failing due to port mapping is fixed. what should I do?