ECS - Elastic Container Service
ECS - Elastic Container Service
2h 49m

In this lecture I will provide a high level overview of the Amazon Elastic Container Service, commonly known as Amazon ECS.  This service allows you to run Docker-enabled applications packaged as containers across a cluster of EC2 instances without requiring you to manage a complex and administratively heavy cluster management system.  


Resources referenced within this lecture:

Introduction to Docker

Basics of using Containers in Production


Hello, and welcome to this short lecture which will provide a high-level overview of the Amazon EC2 Container Service, commonly known as Amazon ECS. This service allows you to run Docker-enabled applications packaged as containers across a cluster of EC2 instances without requiring you to manage a complex and administratively heavy cluster management system. The burden of managing your own cluster management system is abstracted with the Amazon ECS service by passing that responsibility over to AWS, specifically though the use of AWS Fargate. 

If you're new to some of these terms such as Docker, containers, and AWS Fargate then let me quickly, in a single sentence, define what they are to help you understand this service a little easier. AWS Fargate is an engine used to enable ECS to run containers without having to manage and provision instances and clusters for containers. Docker is piece of software that allows you to automate the installation and distribution of applications inside Linux Containers. So what are containers? A Container holds everything that an application requires to enable it to run from within it's isolated container package. This may include system libraries, code, system tools, run time, etcetera. But it does not include an operating system like a virtual machine does, and so reduces overhead of the actual container itself. 

Containers are decoupled from the underlying operating system, making Container applications very portable, lightweight, flexible, and scalable across a cloud environment. This ensures that the application will always run as expected regardless of it's deployment location. With this in mind, if you are already using Docker, or have existing containerized applications packaged locally, then these will work seamlessly on Amazon ECS. For more information on Docker and Containers, please see our existing content found here. Let's now take a deeper look at the EC2 Container Service and some of the additional functions that it provides. 

As I mentioned before, EC2 Container Service removes the need for you to manage your own cluster management system thanks to its interactions with AWS Fargate. You don't even have to specify which instance type to use. This can be very time consuming and requires a lot of overhead to continue to monitor and maintain and scale. With Amazon ECS there is no need to install any management software for your cluster, neither is there a need to install any monitoring software either. All of this, and more, is taken care of by the service, allowing you to focus on building great applications and deploying them across your scalable cluster. 

When launching your ECS cluster you have the option of two different deployment models: a Fargate launch and an EC2 launch. The Fargate launch requires far less configuration and simply requires you to specify the CPU and memory required, define the networking and IAM policies in addition to you having to package your applications into containers. However, with an EC2 launch you have a far greater scope of customization and configurable parameters. For example, you are responsible for patching and scaling your instances, and you can specify which instance types you used, and how many containers should be in a cluster. 

There are use cases for both modes. You may need more granularity and control with some of your clusters due to security and compliance controls. Monitoring is taken care of through the use of AWS CloudWatch, which will monitor metrics against your containers and your cluster. Those of you who have used CloudWatch before will be aware you can easily create alarms based off of these metrics providing you notification of when specific events occur such as your cluster size scaling up or down. An Amazon ECS cluster is comprised of a collection of EC2 instances. As such, some of the functionality and features that we've already discussed in this course can be used with these instances. For example Security Groups to implement instance level securely at a port and protocol level, along with Elastic Load Balancing and Auto Scaling. Although these EC2 instances form a cluster, they still operate in much the same way as a single EC2 instance. So again, for example, should you need to connect to one of your instances itself, you could still use the same familiar methods such as initiating an SSH connection. 

The clusters themselves act as a resource pool, aggregating resources such as CPU and memory. The cluster is dynamically scalable, meaning you can start your cluster as a single small instance, but it can dynamically scale to thousands of larger instances. Multiple instance types can be used within the cluster if required. Although the cluster is dynamically scalable, it's important to point out that it can only scale within a single region. Amazon ECS is region-specific, so it can span multiple availability zones, but it cannot span multiple regions. With ECS you can schedule your containers to be deployed across your cluster based on different requirements, such as resources requirements or specific availability requirements, through the use of multiple availability zones. The instances within the Amazon ECS cluster also have a Docker daemon and an ECS agent installed. These agents communicate with each other allowing Amazon ECS commands to be translated into Docker commands.

About the Author
Learning Paths

Stuart has been working within the IT industry for two decades covering a huge range of topic areas and technologies, from data center and network infrastructure design, to cloud architecture and implementation.

To date, Stuart has created 150+ courses relating to Cloud reaching over 180,000 students, mostly within the AWS category and with a heavy focus on security and compliance.

Stuart is a member of the AWS Community Builders Program for his contributions towards AWS.

He is AWS certified and accredited in addition to being a published author covering topics across the AWS landscape.

In January 2016 Stuart was awarded ‘Expert of the Year Award 2015’ from Experts Exchange for his knowledge share within cloud services to the community.

Stuart enjoys writing about cloud technologies and you will find many of his articles within our blog pages.