Application architecture - Amazon ECS

Application architecture

You can follow one of the two following models to run your containers:

  • Fargate launch type - This is a serverless pay-as-you-go option. You can run containers without having to manage your infrastructure.

  • EC2 launch type - Configure and deploy EC2 instances in your cluster to run your containers.

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

Using the Fargate launch type

The Fargate launch type is suitable for the following workloads:

  • Large workloads that require low operational overhead

  • Small workloads that have occasional burst

  • Tiny workloads

  • Batch workloads

When architecting your application to run on Amazon ECS using AWS Fargate, you must decide between deploying multiple containers into the same task definition and deploying containers separately in multiple task definitions.

If the following conditions are required, we recommend deploying multiple containers into the same task definition:

  • Your containers share a common lifecycle (that is, they're 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.

If these conditions aren't required, we recommend deploying containers separately in multiple task definitions. This is because, by doing so, you can scale, provision, and deprovision them separately.