What is AWS Fargate and how it works

W

AWS Fargate is a part of Amazon Elastic Container Service. ECS – it is a highly scalable and fast container management service. You can use it to run, stop, and manage containers on a cluster. So, in fact ECS is a docker orchestration tool. There are two main models that you can use to run your containers:

  • Fargate launch type
  • EC2 launch type

Current article is oriented at Fargate – serverless infrastructure for running containers.

In case we want to deploy application at AWS Fargate, such an application should be configured to run in a container. So, at the beginning we need to perform next steps:

  • create Dockerfile
  • build docker image
  • push docker image at AWS docker registry – ECR

Then we have to define different parameters for our dockerized app and describe how exactly we want it to be run – that is done with using so-called task definition, which is nothing more than a json file with different properties. ECS uses task definition to run our dockerized app in the way we defined it. Such a “running” app is called a task. Then we have a next layer – it is called service. In fact, it is a scheduler, which helps us to maintain the desired number of tasks, we also can treat it as a task manager. Tasks and services are wrapped at the next logical abstraction layer, which is called an ECS cluster. 

As you understand, to run containers we need some real physical  infrastructure. In case ECS – it can be EC2 and Fargate. Generally speaking Fargate – it is simply a higher abstraction layer for EC2, that is not something completely new – but only a good marketing step from AWS side. Anyway – that abstraction layer helps us to get rid of server’s management, that saves out time and operational cost for according infrastructure support.

In case Fargate launch type, there is one more deeper segregation. We can choose between 2 capacity providers. It is Fargate by itself, and there is one more interesting type, which is called Fargate Spot.

Fargate Spot – Run interruption tolerant Amazon ECS tasks at a discounted rate compared to the AWS Fargate price. Fargate Spot runs tasks on spare compute capacity. When AWS needs the capacity back, your tasks will be interrupted with a two-minute warning.

There is one essential limitation here – you can only use Fargate Spot for Linux tasks with X86 architecture. Fargate Spot  is very interesting and together with that tricky tool. I am speaking a lot about it at my course: “AWS Fargate DevOps: Autoscaling with Terraform at practice“. For now simply remember, that while using it wisely, we can save a lot of money with preserving acceptable availability.

That is all for theory, if next articles I will try to describe how to deploy test python web application at AWS Fargate using Terraform. After that we will speak about different autoscaling options, that we can use at AWS Fargate service – it is the real power and the main reason to start using Fargate. If you do not want to miss it, please, subscribe to my newsletter:


Best regards!


architecture AWS cluster cyber-security devops devops-basics docker elasticsearch flask geo high availability java machine learning opensearch php programming languages python recommendation systems search systems spring boot symfony