1

I use three services in my docker-compose file: Django API, Celery, and Redis. I can run this using AWS ECS for which I have to create 3 services (one for each service) and at least three tasks for each service created which seems to be expensive when compared to AWS EC2 instance where I can deploy 3 services by running docker-compose command and also I can attach Auto-scaling groups for horizontal scaling by creating an Image of my instance and attach a Load balancer to it.

I don't understand why should one use ECS which is mainly used for auto-scaling multi-service dockerized applications when I can do the same with simple EC2 auto-scaling groups. Am I missing something?

1 Answers1

3

The "why should one use ECS" is a question of "why to use an abstraction" at its heart. To answer it, ECS bills itself as a "fully managed container orchestration service" and provides an abstraction on top of a cluster of EC2 instances (run and managed by you or by AWS, depending upon the choices you make). It will come down to these choices which you want to consider before choosing to use (or NOT choosing ) ECS:

  1. Do you want to do mapping of containers to EC2 instances yourself OR do you want your container orchestration engine to take care of it for you?

  2. Do you want to be even aware of underlying EC2 instances and hence be responsible for running and patching them OR do you want your container orchestration engine to take care of it for you?

  3. Do you want to own responsibility of redeploying newly built and tested containers on all your EC2 instances individually OR do you want your container orchestration engine and associated compute platform (eg. Fargate) to take care of it for you?

  • In 3rd point, by attaching Autoscaling Groups (ASG) with AWS Codepipeline (gets triggered by Github branch) I can deploy my docker app to all my ASG instances automatically. It's near to impossible to create multiple service docker containers using ECS & expensive too whereas in EC2 you can easily deploy it with docker-compose cmd. I tried service discovery & ECS-CLI but couldn't make all my services work together. So I replaced Celery & Redis with Lambda & SQS for the asynchronous process & use only one Django container in ECS. Do you think it's cost-effective and easier to deploy in EC2 ASG? – Kaushik Ganesan May 27 '21 at 05:42