What is AWS Fargate?

Paloma Lataliza
4 min readJul 31, 2022

ECS
ECS is a container management service. Its main purpose is to facilitate the management of Docker containers for your application. In computing, there are two main options: EC2 and Fargate

TO USE ECS WE NEED:

  • ECR: It is a service that stores, manages and deploys Docker images.
  • CLUSTER: The cluster is a logical grouping of tasks and services.
  • SERVICE: It is the task manager. If there is a failure in a task, which will bring down the process, it will restart the same trying to make the recovery. In addition, it can be configured to automatically scale the task, use deployment strategies, and be linked to a load balancer;
  • TASK: A task is the minimum unit of work in ECS. It must be linked to a task definition, and may or may not be associated with a service.
  • TASK DEFINITION: It is the specification of an ECS task. In it, you can inform the configuration of containers, amount of memory/CPU, configuration of volumes, network mode, etc.

WHATS IS AWS FARGATE?

The AWS made Fargate available as an option on its ECS service in late 2017. Fargate is a serverless compute engine for container management that supports both ECS and EKS.
It takes care of all the infrastructure needed for your containers. Each container must be configured in its task definition to know how much CPU processing will be required and how much memory will be consumed. After that, ECS Fargate takes care of making your container available, ensuring scalability and charging only while it is in use.

USING FARGATE ON AN NGINX SERVER

Step 1

First let’s create our cluster to run our Nginx server:

Step 2

Now let’s create our task definition that will serve as a template for our container settings:

Step 3

Let’s create a service and through it, we will publish our task:

The next step is the network and security configuration and you can do it just like you would on an ECS + EC2. You just need to add a VPC and Subnets, a security group and lastly a load balancer if you want.

Last Step

Now we can check the cluster and our published application. You can access it with the ALB or IP address of the task linked to the created service.

You can see more in the AWS documentation:

--

--

Paloma Lataliza

Apaixonada por cloud computing e tecnologia. Fã de cavaleiros do zodíaco. AWS Community Builder, líder do AWS User Group MG. Também escrevo sobre ☁️