Docker for AWS vs pure Docker deployment on EC2 Docker for AWS vs pure Docker deployment on EC2 docker docker

Docker for AWS vs pure Docker deployment on EC2


If you need to provide a portability across different cloud providers - go with AWS CloudFormation template provided by Docker team. If you only need to run on AWS - ECS should be fine. But you will need to spend a bit of time on figuring out how service discovery works there. Benefit of Swarm is that they made it fairly simple, just access your services via their service name like they were DNS names with built-in load-balancing.

It's fairly easy to automate new environment creation with it and if you need to go let's say Azure or Google Cloud later - you simply use template for them to get your docker cluster ready.

Docker team has put quite a few things into that template and you really don't want to re-create them yourself unless you really have to. For instance if you don't use static IPs for your infra (fairly typical scenario) and one of the managers dies - you can't just restart it. You will need to manually re-join it to the cluster. Docker for AWS handles that through IPs sync via DynamoDB and uses other provider specific techniques to make failover / recovery work smoothly. Another example is logging - they push your logs automatically into CloudWatch, which is very handy.

A few tips on automating your environment provisioning if you go with Swarm template:

  1. Use some infra automation tool to create VPC per environment. Use some template provided by that tool so you don't write too much yourself. Using a separate VPC makes all environment very isolated and easier to work with, less chance to screw something up. Also, you're likely to add more elements into those environments later, such as RDS. If you control your VPC creation it's easier to do that and keep all related resources under the same one. Let's say DEV1 environment's DB is in DEV1 VPC
  2. Hook up running AWS Cloud Formation template provided by docker to provision a Swarm cluster within this VPC (they have a separate template for that)

My preference for automation is Terraform. It lets me to describe a desired state of infrastructure rather than on how to achieve it.


I would say no, there are basically no other benefits.

However, if you want to achieve all/several of the things that the docker-for-aws template provides I believe your second bullet point should contain a bit more.
E.g.

  • Logging to CloudWatch
  • Setting up EFS for persistence/sharing
  • Creating subnets and route tables
  • Creating and configuring elastic load balancers
  • Basic auto scaling for your nodes

and probably more that I do not recall right now.

The template also ingests a bunch of information about related resources to your EC2 instances to make it readily available for all Docker services.

I have been using the docker-for-aws template at work and have grown to appreciate a lot of what it automates. And what I do not appreciate I change, with the official template as a base.


I would go with ECS over a roll your own solution. Unless your organization has the effort available to re-engineer the services and integrations AWS offers as part of the offerings; you would be artificially painting yourself into a corner for future changes. Do not re-invent the wheel comes to mind here.

Basically what @Jonatan states. Building the solutions to integrate what is already available is...a trial of pain when you could be working on other parts of your business / application.