taskdefinition

AWS Elastic Container Service – Everything you need to know | part 1

ECS – Elastic Container Service! It might sound all greek to you, yet, I assure you that by the end of this tutorial series you’ll know lots about it. So bare with me. Subscribe to my channel. (wink)

First thing first. What is ECS ?

So this is what the documentation have to say: 

It’s a highly scalable, container-orchestrated service that supports Docker containers and will allow you to easily run and scale containerized application on AWS.

In other words, ECS allows you to run containerized apps on AWS, and that’s all what you need to know.

In the first ½ of this tutorial, lets cover the theoretical aspects of ECS and then complete a fully fledged practical session where you will containerize a dotnet-Core app with Docker and have it up and running on ECS. Finally, we’ll also look at how we could use AWS cloud formation to setup the infrastructure.

What you’ll need to know to follow this tutorial series:

  • Basic Docker understanding
  • Docker installed
  • Visual studio installed 
  • AWS account 

Docker in a nutshell

Docker URL - TheHungryFatCoder

Imagine an instance where you require several applications to collaborate with each other to perform a desired output. And, these applications needs to run on the same environment where each of them requires different Java versions installed. 

Since, the host machine is installed with java 6, there’ll be many issues running the other 2 application which requires Java 7 and 8. Docker solves this by allowing each application to have its own version of java installed, hence overcoming this issue.

Another example would be that the piece of code you wrote runs on your machine but, not on the test environment. Using Docker you could bundle all the dependencies thereby guaranteeing a smooth run.

Using docker container means you can abstract the software, OS, hardware config from the App and have a standard building block where you can run anywhere.

ECS in a nutshell

AWS ECS - TheHungryFatCoderECS Abstracts away which machine runs in which container. It treats a bunch of instances that you rent as a shared pool, and combines it together and lets the ECS decides which instance in the pool runs which container.

If an instance goes away ECS will notice it and monitors containers, maintain logs on information such as which container ran it etc.

While giving the develop full control, it allows you to store the images, monitor containers, and maintain logs.

 

Instance, Cluster, Task, Service

It’s all confusing! Prior to continuing with this tutorial lets understand what these terminologies are.

The following diagram illustrates what these really mean:

  • ECS Cluster – is nothing but a logical grouping of container instances.
  • Container instances – It’s simply an EC2 instance. However, you could uniquely identify a container instance with a plain EC2 instance as it has an ECS agent installed in it, then have Docker installed and its registered to an ECS Cluster.
  • Task definition – Its a blueprint that explains which Docker container to run and represent your application. It will contain information such as which container to use, CPU allocation, Memory to allocate, env variables, ports to expose.
  • Task – An instance of a Task definition, running the definition derived within it. Based on demand, multiple tasks can be created by a task definition.
  • Services – Defines the minimum and maximum Task from one Task-Definition at a given time, auto scaling and load balancing. A service is responsible to create Task. Services can be used to configure load balancer.

 

Stay tuned for Part 2.

If you are already on instagram, please follow my handle @thehungryfatcoder.