AWS Fargate

Sofyan Hadi Ahmad
4 min readNov 18, 2019

Why AWS Fargate?

Before we jump deeper, let us understand why AWS build Fargate in the first place. As you may already know, AWS already has powerful Elastic Container Service (ECS) and Elastic Kubernetes Service (EKS), and both of them are really powerful and popular. The main motivation to use Fargate is to remove any responsibility of provisioning, configuring and managing the EC2 instances by allowing AWS Fargate to manage the EC2 instances.

If you’re using ECS, you may aware ECS has two launch types that can define how the compute resources will be managed. The traditional EC2 and Fargate. If you’re choosing traditional EC2 Deployment, you need to set up your cluster manually, you need to set the repository for the docker image, port mappings, environment variables, and volumes to attach. Almost all of the Docker command-line command will be mapped to the Task definition. After you setup then Task, ECS Services detail the auto-scaling nature of the Tasks. If a task is stopped, the corresponding ECS Service can restart the Task or launch a new instance to replace it.

EKS is the managed Kubernetes hosting environment supported by AWS. If you are already using an on-premise or cloud provided a host for Kubernetes, or are looking to utilize a defacto industry standard for open source orchestration of containers, EKS can provide many benefits of Kubernetes without the responsibility of the operations of hosting and configuring the Kubernetes environment.EKS is actually manged Kubernetes by AWS, it’s not different compare with manually installed Kubernetes, except for auto provisions and easy to configure. You can use EKS when you are want to keep your infrastructure portable for other cloud providers or you have recruitment to deploy your app in on-premise environment, you want to utilize the most flexible and future-proof managed container environment, you want to ensure open source tools are used as much as possible or you want developers and operations to be able to determine how containers are managed. If not, you should consider using AWS Fargate.

What is AWS Fargate?

AWS Fargate is a compute engine for deploying and managing containers, which frees you from having to manage any of the underlying infrastructures. With AWS Fargate, you no longer have to provision, configure, and scale clusters of virtual machines to run containers.

AWS Fargate enables you to focus on your applications. You define your application content, networking, storage, and scaling requirements. There is no provisioning, patching, cluster capacity management, or any infrastructure management required.

ECS is a highly scalable, high-performance container management service that supports Docker containers and allows you to easily run applications on a managed cluster of Amazon EC2 instances. With Fargate, the concept of server provisioning, cluster management, and orchestration completely goes away. ECS uses containers provisioned by Fargate to automatically scale, load balance, and manage the scheduling of your containers for availability, providing an easier way to build and operate containerized applications.

Some of the benefits of implementing AWS Fargate you are the following:

  1. Seamless Scaling
  2. EKS and ECS integration
  3. Eliminate manual configuration

Key Concepts

Task Definition

A task definition is required to run Docker containers in Amazon ECS. Some of the parameters you can specify in a task definition include:

  1. The Docker image to use with each container in your task
  2. How much CPU and memory to use with each task or each container within a task
  3. The launch type to use, which determines the infrastructure on which your tasks are hosted
  4. The Docker networking mode to use for the containers in your task
  5. The logging configuration to use for your tasks
  6. Whether the task should continue to run if the container finishes or fails
  7. The command the container should run when it is started
  8. Any data volumes that should be used with the containers in the task
  9. The IAM role that your tasks should use

You can imagine task definition is a blueprint of an object, which in this case is a task blueprint. You should deploy multiple tasks instead of one, so when one task is down you still have other tasks that will come into the picture.

ECS cluster is a logical grouping of tasks or services. If you are running tasks or services that use the EC2 launch type, a cluster is also a grouping of container instances. When you first use Amazon ECS, a default cluster is created for you, but you can create multiple clusters in an account to keep your resources separate. Suppose you’re using AWS Fargate, all ECS Cluster will be managed by Fargate, so you don’t have to worry about it for now.

--

--