Open In App

How to Use AWS Fargate to Deploy Containerized Applications without Managing Servers?

Last Updated : 17 Oct, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Fargate provides a server-less architecture, where we do not need to worry about the backend infrastructure on which our application gets deployed. Fargate provides of a simple provisioned infrastructure that is entirely managed and taken care by aws. Application deployment becomes easy and efficient. Using fargate you have to take care only of the application needs and need not think about any infrastructure related concern, making deployment simpler and easy.

How Does Fargate Work?

  • Fargate is used to run containers in the backend with the entire infrastructure managed by amazon web services (aws).
  • With Fargate we do not need to give any infrastructure for the containerised application.
  • Fargate packages the application including the CPU and memory.
  • It very carefully allocates each task to different kernel CPU and memory resources.

Fargate Task Definition: Fargate task definition is a blue print of the application structure where we get the chance to define CPU and memory for the application configuration which is stored in our containers as image.

Fargate Tasks : Fargate task are instantiation of the fargate task definition and they are run here within the cluster.

Fargate task which are launched as a part of ECS service fall under the service scheduler managed category. Here the entire infrastructure of target resources and managed on the backend without the need to maintain any infrastructure instance.

Benefits of Using Fargate

Below are the benefits of using Fargate:

  • With Fargate we do not need to give any infrastructure for the containerised application.
  • Fargate packages the application including the CPU and memory.
  • It very carefully allocates each task different kernel CPU and memory resources.

Monitoring Fargate Tasks/Steps to Create Fargate container

1. Create a task definition.

Inside the task definition, specify the application image. This is done within the container of the task definition. Also specify parameters such as family, port, cmd, entry point, volume or any other additional configuration here in the task definition.

2. Creating Fargate Task

Once the task definition is created, there are two options to deploy the task definition as stand- alone part or as a apart of ecs service within cluster.

3. Running of Fargate Task

In both, fargate as stand alone or running fargate as a part of ecs service for the fargate task there is no need to worry about managing the application without scaling the application as fargate automatically manages the application need of managing the infrastructure.

Step by Step Depiction of Creating Fargate Resources

Step 1: Creating a Fargate Task definition. In this step, we have taken for example a nginx public docker image, you can replace this with the image of your choice. The public images need internet access for pulling them. If you are using private images make sure that you use private images and use private subnets for pulling the image.

Specifying task cpu and memory in fargate task definition

Using nginx image inside container

Step 2: Run an instantiation of the fargate task definition that was created in step 1. The created task definition can be used to run standalone tasks or tasks as a part of ecs service. In this example, we will run the task directly as a stand alone task.

Running fargate task

Step 3: Once, the task is started, it will take some time to come into running state. We can see the task comes into active state and then the task has eventually come into running state.

task in running state

Best Practices for Using Fargate

  • Always take care to provision cpu, memory as per application requirements.
  • Application deployment becomes easy and efficient so small application which need quick infrastructure and needed focus on application can be provisioned using fargate.

FAQs On AWS Fargate

1. Do We Need To Take Care Of Infrastructure With Fargate?

No, there is need not worry about infrastructure at the user end.

2. Who Is Responsible For Managing Fargate ?

Fargate in the backend is AWS managed infrastructure.

3. Can We Use Fargate For Tasks Which Are Part Of ECS Service?

Yes, Fargate can be used as part of ecs service.

4. Can We Run Fargate Task As Stand-Alone Tasks?

Yes, fargate tasks can be run as both standalone tasks or tasks as a part of service.


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads