I want to migrate from Heroku to Amazon AWS and I would like to deploy my app in Docker image. So the app consists of:
With my app I (Web+Worker):
And now when studying Amazon docs I found "Elastic Beanstalk" and "Amazon EC2 Container Services (ECS)". I was wondering which one should I use to manage my application (docker images)? What is a difference between them?
In comparison to Elastic Beanstalk, Elastic Container Service provides greater control over application architectures and orchestration of Docker containers. You specify the size and number of cluster nodes and determine if auto-scaling should be used. Elastic Container Service uses tasks to launch Docker containers.
Amazon ECS uses Docker images in task definitions to launch containers. Docker is a technology that provides the tools for you to build, run, test, and deploy distributed applications in containers. Docker provides a walkthrough on deploying containers on Amazon ECS.
The benefit of Elastic Beanstalk is its ease of use. The AWS Management Console makes it easy to start a highly scalable application just by supplying your application code. Your team doesn't need to be experts in AWS. And you don't need to hire a DevOps engineer or team to manage your environment for you.
ECS orchestrates Docker containers, but the containers run on EC2 instances. EC2 instances provide the virtual machines that Docker containers need in order to run. AWS released ECS Anywhere in May 2021. ECS Anywhere is the on-premises version of Amazon ECS.
AWS Elastic Beanstalk uses the Amazon EC2 Container Service under the hood for its Multicontainer Docker Environments, and the difference is addressed by the resp. FAQ How is Amazon ECS different from AWS Elastic Beanstalk?
AWS Elastic Beanstalk [...] keeps the provisioning of building blocks (e.g., EC2, RDS, Elastic Load Balancing, Auto Scaling, CloudWatch), deployment of applications, and health monitoring abstracted from the user so they can just focus on writing code. You simply specify which container images are to be deployed, the CPU and memory requirements, the port mappings, and the container links. Elastic Beanstalk will [...] handle all the details such as provisioning an Amazon ECS cluster, balancing load, auto-scaling, monitoring, and placing your containers across your cluster.
[...] You can work with Amazon ECS directly if you want more fine-grained control for custom application architectures. [emphasis mine]
Furthermore, only Elastic Beanstalk supports Heroku's push deployment model (see the deploy command of the EB Command Line Interface), so for your scenario I would definitely recommend to look into Elastic Beanstalk's Multicontainer Docker Environments, rather than using Amazon ECS directly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With