# Start with AWS Container Technologies

Hi devs around the world

I plan to write a series of blog posts about AWS container technologies. In this first article i blog about a quick intro and a high level overview of the services. In later posts I go deep dive in the services and show you some examples.

Happy Reading 😃

# **First Quick History**

First the journey begins with [**Amazon Elastic Compute Cloud**](https://aws.amazon.com/ec2/) or **EC2**. EC2 are virtual machines where you can host your apps on AWS. You can think there is a machine hosted on Amazon's data centers across the globe and you can rent an environment where you can deploy your app.

The image below illustrates this scenario with **4 applications** in one EC2-Machine.

![ec2.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1610903424083/UjIIDMDLs.png align="left")

This architecture implies that you must configure and install all your required packages and configurations for each app **directly on the EC2 Instance**. But there are many long automation processes involved:

* update your tomcat configuration
    
* need another system-wide package
    
* scale to 1000 EC2 Instances 😮
    
* ...
    

The list goes on, you must every time log in to your EC2 and update or patch these requirements and this is not a good development experience

But there is a solution for automation - DOCKER or containerized applications 😝

**Automated Solution Docker**

With the rise of Container tech especially [Docker](https://www.docker.com/), the deployment and development of applications are more repeatable and automated. We can define our environments, packages and so on for each application in a central **Dockerfile** on our local machine and the deployment of our application environment is automated on each hosted machine on every deployment.

![docker.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1610905416242/e-Sa4JQhg.png align="left")

# **Entering Container Services for AWS**

AWS offers two basic services for deploying containerized Applications on AWS

* [Amazon Elastic Container Service](https://aws.amazon.com/fargate/)
    
* [Amazon Fargate](https://aws.amazon.com/ecs/)
    

With ECS we have the concept of container technology. AWS defines the following building blocks in ECS

* **Cluster**
    
* **Task definitions**
    
* **Tasks**
    
* **Services**
    

Don't worry we go deeper in further posts to the building blocks mentioned. It's important first to understand at a high level what's going on and the philosophy behind them.

# **Introduce ECS**

Bellow diagram illustrates the concepts at high-level architecture. We have further an **EC2-Instance** but this time we have an **ECS-Agent** installed on that EC2, which is responsible to manage the Docker-Container and register this as an AWS service. The execution of a Docker container in EC2-Instance is called a **Task**.

Summarize:

* Containerize the app (create Dockerfile)
    
* EC2-Instance with running ECS-Agent
    
* ECS-Agent manages dockerized apps as Tasks and registers it as AWS service
    
* Run dockerized App in EC2 as **Task**
    

![first.ecs.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1610908409949/XDDJgI4lg.png align="left")

\*\* ECS-Agent \*\*

The ECS-Agent registers our machine in a **Cluster**. This [Cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html) orchestrates our Tasks and Services.

![cluster.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1610909593522/6efziVs7Q.png align="left")

\*\* What if we need to scale up ?\*\*

In order to handle the increased load we need to run more EC2-Instances with ECS-Agent installed.

AWS helps us to create EC2-Instances automatically with [Auto-Scaling Service](https://aws.amazon.com/autoscaling), but I go deeper with this building block in another post.

For this post, we create another EC2-Instance manually with ECS-Agent installed and deploy our dockerized apps on it. The Agent registers the EC2-Instance automatically at the Cluster Level.

![cluster_scale.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1610909737387/a0ebZjcdc.png align="left")

First that all about ECS at a high level, I go deeper in further posts 😊

# **Introduce Fargate**

Image your next application becomes very popular and your EC2-Instances hit heavy load from your users. You have no time to go down and won't scale up to 1000 EC2-Instances, this scenario is very cumbersome and buggy.

\*\* From AWS Docs \*\*

> AWS Fargate is a serverless compute engine for containers that work with both Amazon Elastic Container Service (ECS) and Amazon Elastic Kubernetes Service (EKS). Fargate makes it easy for you to focus on building your applications. Fargate removes the need to provision and manage servers, lets you specify and pay for resources per application, and improves security through application isolation by design.

Ok ok, AWS mentions the buzzword [Serverless](https://en.wikipedia.org/wiki/Serverless_computing) 😂

Yesss this is amazing, Serverless is also explained in the above Quote from Amazon:

> Fargate makes it easy for you to focus on building your applications. Fargate removes the need to provision and manage servers,

This is very amazing you don't need to create and manage EC2-Instances, create your dockerized applications, push them to Amazon and run it as **Fargate Tasks**. If you want to scale up you only increase the number of your running Tasks.

![fargate_serverless.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1610910615871/kyAbTWpOQ.png align="left")

As you can see from the diagram above we have the building blocks from ECS, except Agent and EC2.

I prefer Fargate as AWS Service for building containerized applications on AWS, because I can focus on my business logic rather than infrastructure.

This article was only a high-level of introduction to AWS Container Ecosystem. In further posts, I go deeper with Fargate and the concepts behind the building blocks.

Happy coding and reading 🚀 ! Stay healthy
