23

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?

Nick
  • 11,483
  • 8
  • 41
  • 44
  • There's a new container service that's much more tailored to docker apps. https://aws.amazon.com/blogs/aws/cloud-container-management/ – Dax Fohl Feb 10 '15 at 16:52

2 Answers2

23

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.

Ben Whaley
  • 32,811
  • 7
  • 87
  • 85
  • 2
    Thanks Ben! Your blog post is a very interesting read (actually I got stuck on your website reading all the other stuff as well ;) I didn't expect such severe limitations of Beanstalk, for now I am going to go ahead and just run Docker containers inside a small EC2 instance. I'm curious how well that will run. – Nick Sep 15 '14 at 07:31
  • What if you were just running ONE high-load application that just ran on a single container and connected to an RDS database. In that scenario, would you just run a single docker instance, or a multiple-container docker instance to somehow maximize resources? – Brian FitzGerald Mar 01 '16 at 19:09
2

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

Community
  • 1
  • 1
beginer
  • 188
  • 1
  • 11
  • 2
    Mentioned link is broken. Just sharing new links :) http://docs.aws.amazon.com/AmazonECS/latest/developerguide/docker-basics.html – SajithP Mar 08 '17 at 06:37