Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amazon Elastic Beanstalk vs EC2 instance with docker containers

Tags:

If I understand correctly, Elastic Beanstalk creates an EC2 instance for each application you deploy. However, an application typically doesn't run at 100% CPU, yet amazon charges you per instance used. So if I deployed 5 apps with Dockerfiles, AWS would charge the usage of 5 EC2 instances per month.

With this in mind, can't I just simply launch an EC2, install docker and run my containers in there? Wouldn't that be much more cost-effective?

like image 746
Nick Avatar asked Sep 14 '14 11:09

Nick


People also ask

Which is better Elastic Beanstalk or EC2?

In the case that you want to reduce system operations and just focus on the website, then Elastic Beanstalk would be the best choice for that. Elastic Beanstalk supports a PHP stack (as well as others). You can keep your site in version control and easily deploy to your environment whenever you make changes.

Does Elastic Beanstalk support Docker?

Elastic Beanstalk supports the deployment of web applications from Docker containers. With Docker containers, you can define your own runtime environment.

Is AWS Elastic Beanstalk a container service?

AWS Elastic Beanstalk is an easy-to-use service for deploying and managing web applications and services. It not only supports applications developed with modern popular programming but also supports containerization on modern servers, including Nginx, Apache, Passenger, and IIS.


Video Answer


2 Answers

AWS has integrated Elastic Beanstalk (EB) with the EC2 Container Service (ECS) to support multi-container Docker environments. An EB environment composed of multiple instances in an autoscaling group can run multiple containers per instance, managed through the ECS agent and its API. Use .ebextensions to map multiple ELB listeners to the containers running on EC2 instances.

See this tutorial for running an Nginx + PHP-FPM in separate containers.

Thanks @Synturas for tipping me off to this update.

like image 52
Ben Whaley Avatar answered Sep 28 '22 07:09

Ben Whaley


Yes your assumptions are correct. The difference is that for doing it on EC2 you will have to manage and monitor your containers all by yourself. So I guess for production environments you'll have to have your own team for that, or else go with BeanStalk.

Also better follow this Docker on Amazon documentation.

Edit

Thanks for the comment @sajithp I have updated the link

like image 31
beginer Avatar answered Sep 28 '22 08:09

beginer