Introduction to Amazon’s Elastic Container Service

Intro to Amazon's Elastic Container ServiceThe world today is increasingly transformational and agile. Business is in perpetual motion constantly adopting new technologies in the hope of creating the slightest competitive advantage. The newest wave in business IT is containerization, which is becoming ever more popular due to Docker. Indeed, many businesses have already migrated from virtual machines to Docker containers.

Docker is an open source tool that allows you to package your applications in a lightweight bundled stack, working as an additional level of abstraction on top of a machine’s operating system. Containerization helps speed up the development process and introduces flexibility in its agile methodology. It is different from virtualization as virtual machines run entire operating systems from kernel up while containers are comprised only of single processes and their dependencies. Docker Engine makes use of existing OS kernel to deploy the containers. This not only improves the application performance but also reduces its footprint.

One major benefit containers bring to developers is to free them from having to worry about the underlying operating system, thereby allowing them to focus on application development. When practicing DevOps, the container management becomes simpler as it removes the administrative overhead of managing a larger number of systems.

Docker Management

When the containers concept was introduced, managing Docker containers was tedious.  There was no simple way to orchestrate these containers while running a required number of them on managed instances. Today, however, various tools, each with their pros and cons, have been developed to suit a wide variety of use cases.

Managing containers involves handling the deployment process as well as monitoring the performance and lifecycle of running containers. Large-scale deployment brings with it the overhead burden of monitoring, deployment, configuration, automation, and management. To address this, various tools were introduced to handle orchestration. The most popular among these are Kubernetes, Swarm Mode and AWS ECS. In this article, we will focus specifically on AWS ECS.

AWS ECS

AWS EC2 Container Service (AWS ECS) allows you to manage and orchestrate Docker containers in the AWS cloud. It creates a cluster that executes the applications hosted in containers. Furthermore, it offers container management features such as maintaining an arbitrary number of containers, managing Docker images or managing Docker environment variables. Being part of the AWS ecosystem, it has the added advantage of integrating with various other AWS products. It allows configuration of the application’s security with IAM roles and policies. You can also integrate with other AWS services like AWS ELB, AWS EC2, and others.

In addition to allowing you to run microservices in containers, AWS also provides EC2 Container Registry (ECR) to host the images you want to run. ECR is basically a private instance of Docker Registry so you will not have to pay for a separate Docker Hub account nor set up your own registry. Of course, you are not in any way constrained to use the ECR, so if you wish you may choose images from any other registry.

Container management and scheduling can be done from CLI. For that JSON format is used. While Docker users may be more suited to the YAML format used by Docker Compose or Kubernetes, the fields used in JSON are quite similar to those of the above-mentioned tools and most should be self-explanatory. When paired with an infrastructure-as-a-code solution, such as Amazon’s own CloudFormation or Terraform from HashiCorp, those task definitions can provide a good basis for a Continuous Deployment pipeline.

Being part of AWS, ECS integrates easily with other managed services available in the Amazon cloud. You can use ELB for load balancing, EBS for storage, IAM roles for access management and various other building blocks as well. Additionally, ECS is gratis. You only pay for the cost of underlying infrastructure, such as EC2 instances or EBS volumes.

There are also ECS optimized AMI instances, but if you so desire you may setup an ECS agent on any other new or existing instance.  The agent itself is open source with code hosted on GitHub. The binaries are available either as a Yum package, as a Docker container or as a Windows executable, so deployment should not pose a problem.

Cloud Protection Manager

Although there are tools like CloudFormation provided by AWS to help run your infrastructure, there is still lots to do in terms of automation and maintenance such as scheduling snapshots, replicating in more than one region and/or accounts, and managing users. Cloud Protection Manager allows you to backup and restore quickly and easily leveraging native snapshots. CPM snapshots are taken at the block level and therefore is the most efficient backup available. No homegrown scripts needed. You have the freedom to choose snapshot schedules ranging from minutes to months. CPM also supports EBS, RDS, Redshift and Aurora clusters.

Further reading

If you want to learn more about ECS check out our follow-up article. In it, we will show the best use cases for using AWS ECS and Docker in general. We especially recommend it to those already invested in the AWS ecosystem.

Share this post →

You might also like: