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 diver in the services and show you some examples.
Happy Reading 😃
First Quick History
First the journey begins with Amazon Elastic Compute Cloud or EC2. EC2 are virtual machines where you can host your apps on AWS. You can think there is a machine hosted on Amazons data centers across the globe and you can rent an environment where you can deploy your app.
The image bellow illustrates this scenario with 4 application in one EC2-Machine.
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 into 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 specially Docker, 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.
Entering Container Services for AWS
AWS offers two basic services for deploying containerized Applications on AWS
With ECS we have the concept of container technology. AWS defines following building blocks in ECS
- Task definitions
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.
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.
- 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
The ECS-Agent registers our machine in a Cluster. This Cluster orchestrates our Tasks and Services.
What if we need to scale up ?
In order to handle 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 , 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 register the EC2-Instance automatically at the Cluster Level.
First thats all about ECS at high level, I go deeper in further posts 😊
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 want 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 works 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 😂
Yess 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 it to Amazon and run it as Fargate Tasks. If you want scale up you only increase the number of your running Tasks.
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 concepts behind the building blocks.
Happy coding and reading 🚀 ! Stay healthy