AWS Fargate is a service that provisions serverless compute resources to run AWS ECS and EKS containers. AWS states that Fargate allows you to focus on building your applications when you let Fargate provision and manage the infrastructure required. Think of it as containers on-demand with no underlying manually created infrastructure that are quick to launch and scale, where you manage everything at the container level.
AWS Fargate is fully integrated into the AWS ecosystem, all the features that customers have used with EC2 instances such as VPC networking, elastic load balancing, IAM permissions, CloudWatch monitoring are now available to customers at the container level.
Fargate is a powerful serverless service with tons of features that provides users’ more hands-off managed experience.
Essentially, AWS Fargate is a serverless engine that can be used with both ECS and EKS to deploy containers. With AWS Fargate, there is no added headache of having to provision, scale, and patch clusters of servers as in EC2. All you have to do is register your task definition (where you specify CPU/memory and define IAM and networking policies) and Fargate will launch the container for you.
Fargate’s latest platform, version 1.4.0, has introduced some impressive capabilities. They are:
Fargate tasks now support EFS: Elastic File System (EFS) is a scalable, elastic cloud-native shared file system that provides persistent storage capabilities. The new platform version supports EFS, due to which customers can now start running stateful workloads, which was not possible before.
Containerd is replacing Docker as the container runtime: In the latest version, Containerd, a simple runtime has replaced Docker Engine. As AWS Fargate already provides most of the functionality natively, it doesn’t need the advanced functionalities of Docker.
Benefits of AWS Fargate:
1. Less Complexity: Fargate only requires you to focus on building and designing applications. Since Fargate service manages the container parameters and infrastructure requirements, it does away with the complexities of picking instance types, managing cluster scheduling, or cluster optimization.
2. Improved Security: In Fargate, tasks run in their kernels that are entirely isolated from the underlying infrastructure. All you need to do is embed security within your container, and your IT infrastructure is protected through the secure isolation of Fargate.
3. Easy Scaling: Fargate makes for easy scaling. Once you define your application requirements, Fargate scales your containers without you having to worry about provisioning and configuring compute resources.
4. Can Have Lower Costs: Fargate is cost-effective as you only pay for what your task uses and not for unused instances.
5. Application Observability: Through the built-in integrations with AWS services like Amazon CloudWatch Container Insights, Fargate enables you to use third-party tools to monitor your applications.
HOW DOES AWS FARGATE WORK?
To utilise Fargate to manage the deployment of your application container, you will need to have a container stored in a container registry like ECR or DockerHub and set up a task and cluster via ECS or EKS.
The steps in the deployment cycle are:
1) Build a container image
2) Host in a registry ie Amazon ECR or DockerHub
3) Choose an orchestration service – either Amazon ECS or EKS
4) Create a Cluster taking the AWS Fargate option
Your container Image is a read-only template that can be built from a docker file which contains your code, system libraries, tools, runtime and other dependencies required by your application to deploy. The docker file is a plain text file that details all of the required components that generates the container Image for storage in a container registry like DockerHub or Amazon Elastic Container Registry.
Once in the registry, your container can be pulled into a cluster instance to be run whenever required.
To set up the container to run using ECS you will then need to set up a task definition. Typically a task definition is a JSON file containing a blueprint of the requirements and settings needed to run the container. Container definitions like the image type, memory, cpu & network mode.
As you can see, setting up your cluster, tasks and containers using EC2 can be a lengthy and quite complex process.
Using Fargate on the other hand removes the majority of these set up requirements.
Related Posts:
Amazon Web Service – AWS Tutorial
Top 13 Reasons to Why Learn AWS in 2022
What is Amazon Elastic Kubernetes Service (Amazon EKS)?