Application architecture - Amazon ECS

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 to run on Amazon ECS using AWS Fargate, the main question is when should you put multiple containers into the same task definition versus deploying containers separately in multiple task definitions.

When the following conditions are required, we recommend that you deploy your containers in a single task definition:

  • Your containers share a common lifecycle (that is, they are launched and terminated together).

  • Your containers must run on the same underlying host (that is, one container references the other on a localhost port).

  • You require that your containers 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.