Amazon ECS
User Guide for AWS Fargate (API Version 2014-11-13)

Application Architecture

How you architect your application on Amazon ECS depends on several factors, with the launch type you are using being a key differentiator. We give the following guidance which should assist in the process.

Using the Fargate Launch Type

When architecting your application using the Fargate launch type for your tasks, the main question is when should you put multiple containers into the same task definition versus deploying containers separately in multiple task definitions.

You should put multiple containers in the same task definition if:

  • Containers share a common lifecycle (that is, they should be launched and terminated together).

  • Containers are required to be run on the same underlying host (that is, one container references the other on a localhost port).

  • You want your containers to share resources.

  • Your containers share data volumes.

Otherwise, you should define your containers in separate tasks definitions so that you can scale, provision, and deprovision them separately.