How to run an application using Asw Fargate

Posted By :Vikrant Joshi |28th April 2021

 

 

Containerization has completely transformed the cloud architecture over the past few years, allowing businesses to build, deploy & manage applications at a comparatively faster rate. And the propulsion behind containers certainly is not showing any signs of slowing down anyway. 

There are a plethora of propulsion & container orchestration services that are available today in the market. However, most of them will still require you to configure and manage clusters of virtual machines to enable the containers to run. This is when AWS Fargate comes into the picture.

 

What is AWS Fargate?

AWS Fargate is a computer Engine for Amazon Elastic Container Service(ECS) that permits or enables you to run containers without you having to provision, configure & scale clusters of VMs that host container applications. 

AWS Fargate does not need users to manage the EC2 instances themselves. Moreover, You won't need to use EC2 instances now at all. Fargate itself will behave as compute engine. It helps you focus on designing and constructing your application instead of focusing on managing the infrastructure that runs them. 

 

With the Fargate launch type, all one needs to do is pack the application into containers, define IAM policies, specify the memory and CPU requirements & launch the application.

 

AWS Fargate also makes it way easier to scale up your applications. Once you define all your application requirements and specifications, AWS Fargate helps you manage all the scaling and infrastructure that you need to run containers in a highly available method. It seamlessly integrates with Amazon ECS & EKS and helps launch and manage your containers for you.

 

Working Of the AWS Fargate

First, let's have a look at some general terms that you will frequently face while dealing with AWS Fargate: 

 

Container:

A Docker container is a standardized unit for developing software. It contains everything that your software application needs to run- code, runtime, system libraries, system tools, etc. These containers are created using a read-only template called the container image.

 

Container Image:

Images are typically built from a docker file, a plain text file that specifies all of the components included or established in the container. These images get stored in a registry from which they can be then downloaded & run in the container.

 

Task Definitions:

The task definition is a JSON format text file that describes one or even more containers that form your application. You can imagine it as a blueprint for your application.

 

Task:

 A task is generally classified as the instantiation of the task definition set within a cluster. You have the option to mention the number of tasks that will run on your cluster.

 

Clusters:

A cluster is the logical grouping of resources that your application wants. If you use the Fargate launch type with tasks within clusters, Amazon ECS manages your cluster resources. If you use the EC2 launch type, then your clusters will be a group of Amazon EC2 container instances that you have to manage.

 

The picture below gives you a rough idea of deploying your application on ECS using AWS Fargate.

 

 First of all, you got to build a container image that will suit the application and then store it on a registry. Now choose a container orchestration service, either Amazon ECS or Amazon EKS, whichever you want and assign resources to the application. Once you are done with this step, you need to create a cluster to group all the allocated resources. This is where you choose the AWS Fargate launch type. Now AWS Fargate will launch & run all of your containers. It will manage all the underlying infrastructure and clusters. It also seamlessly scales the application needs without you having to even bother about it.

 

AWS Fargate In Action

Step1: On the Amazon Elastic Container Service console, pop on the option 'Get Started'.

You will be directly opened up to a page where it says, "Getting Started with Amazon Elastic Container Service using Fargate".

 

Step2: Now, Create a container definition. You can, anyways, choose preloaded ones if you have just started using AWS Fargate.

 

Step3: Now, Create a task definition. You can use a sample task definition or optionally rename the task definition and modify the Task memory and Task CPU resources by choosing Edit.

 

Step4: Now, Configure a service that will launch and maintain a specified number of copies of the task definition in your cluster. You can use the preloaded service definition or optionally rename the service or review and modify the details by choosing Edit.

 

Step5: As the final step, now you need to configure the cluster. Name your cluster, and then Amazon ECS will take care of the networking and IAM configuration. At last, review what you have done till now and click on Create to finish.

 

That's it! Your web application would be up and running now, finally.

 


About Author

Vikrant Joshi

Vikrant is a Devops Engineer, he has hands on experience on AWS and he is adaptive and flexible.

Request For Proposal

[contact-form-7 404 "Not Found"]

Ready to innovate ? Let's get in touch

Chat With Us