Skip to main content

Docker Automation on AWS

By June 29, 2016September 11th, 2020Best Practices, Blog
elastic beanstalk supports docker automation

By now Docker Container technology is old news and everyone interested is already elbows deep in it. To be perfectly honest my first foray into Docker was very recently after realizing it is so ubiquitous Synology NAS units offer support for it these days.

To understand the concepts discussed, a basic level of familiarity with Docker and AWS is required. We will talk about how to greatly cut down on the number of steps needed to roll out your Containers and apply changes. Our main focus here is going to be automation using the magic of AWS Elastic Beanstalk – a really cool name for basically…templates.

But why Beanstalk?

The reason you do want to use Beanstalk instead of just a naked EC2 instance is ease of setup and teardown. It gets a lot better, Beanstalk can not only take care of building the Docker container with say a pre-configured web server on it, it can automatically add it to your load balancer with the external IP you want (aka ELB in Amazon speak), it can assign firewall rules (aka Security Groups), give you ssh access from the IP you want (and upload your key from your S3 bucket) and it can setup monitoring and usage alerts all on its own(SNS and others).

Ease of setup

Instead of building a virtual server, installing dependencies and Docker itself, Beanstalk takes care of that for us by means of simply filling up a from and uploading recipe and dependency files to S3 – all EC2 configurations steps take place on their own. Same with scaling – Beanstalk will attempt to setup a Load Balancer out of the box.

Another feature that offers a key advantage over naked EC2  (or just plain Docker) is configuration management. Every time a you upload changes to the ‘recipe’ Beanstalk keeps track of the revisions  – this allows for seamless roll-back to a known version you know worked in the past. Better yet, you can spin up additional Environments to test new configurations while existing production environment is untouched. This literally removes the need of maintaining an expensive pre-prod/test/dev environment. Since the setup is automated you just turn it on when you need it.

Cost

Beanstalk is practically free. AWS treats it as an orchestration tool that is simply part of the management plain. Naturally, the underlying resources still incur usage fees, they just happen to be the same fees as the underlying resource would cost if you set it up manually. There is a marginal cost addition of extra S3 storage for storing your ‘Configurations’. This can be deleted if you do not wish to retain past versions.

Cost Savings

Beanstalk integration is available for many other AWS products, Docker is just one of them. However, using Beanstalk with Docker in particular is a fantastic way of reducing your costs. If you do the work upfront and setup ‘templates’ for provisioning and decommissioning you can take full advantage of Spot Instances which are to be had for almost half off. Building a start to finish template that does not require human intervention can be a time consuming task but remember, this is only needed once and once perfected does not require any upkeep.

Summary

If you have been using Docker on AWS the hard way you simply have to try this, you will never look back. If you are new to Docker&Beanstalk now is a great time to build your first container. With AWS Free Tier, you can get a new toolset under your belt for the magical price of free.

Jacob R, PEI

 

Leave a Reply