---
title: "Convenient Serverless Infrastructure via Fargate AWS"
description: "Discover how the Fargate AWS product takes your serverless infrastructure to the next level via Terraform in this ATA Learning tutorial!"
canonical: "https://adamtheautomator.com/fargate-aws/"
---

# Convenient Serverless Infrastructure via Fargate AWS

> Discover how the Fargate AWS product takes your serverless infrastructure to the next level via Terraform in this ATA Learning tutorial!

Source: https://adamtheautomator.com/fargate-aws/

---

ATA Learning

Tap to hide

[

ATA Learning

](/)

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Search for:  

*   [](https://twitter.com/adbertram)
*   [](https://github.com/Adam-the-Automator)
*   [](https://www.linkedin.com/company/adam-the-automator-llc)
*   [](/feed/)

![Convenient Serverless Infrastructure via Fargate AWS](https://adamtheautomator.com/wp-content/uploads/2022/12/fargate-aws.jpg)

# Convenient Serverless Infrastructure via Fargate AWS

[![](https://secure.gravatar.com/avatar/d05ab46ae71ee2393867f96cfec69e3a779ade5f81d9a519fc4d4fab1b177298?s=192&d=mm&r=g)Goodness Chris-Ugari](https://adamtheautomator.com/author/goodness-chris-ugari/)26 December 20225 min. read

Categories: [IT Ops](/category/it-ops/)

Tags:[AWS](/tag/aws/)

Table of Contents

*   [Prerequisites](#prerequisites)
*   [What is Fargate AWS?](#what-is-fargate-aws)
*   [Provisioning Workload for AWS Fargate](#provisioning-workload-for-aws-fargate)
*   [Verifying the Container Deployment](#verifying-the-container-deployment)
*   [Adding a Listener for Port-Forwarding](#adding-a-listener-for-port-forwarding)
*   [Conclusion](#conclusion)

Manually provisioning and managing your applications servers or infrastructure can be a pain. Guessing the required amount of infrastructure resources could lead to overprovisioning. Why not consider taking advantage of Fargate AWS?

AWS Fargate lets you run containers on AWS that offer a serverless infrastructure, so you can spend more time focusing on application development. And in this tutorial, you will learn to deploy a simple containerized application with AWS Fargate.

Read on and avoid outages or downtime in your application!

## Prerequisites

This tutorial will be a hands-on demonstration. To follow along, be sure you have the following:

An [AWS account](https://portal.aws.amazon.com/billing/signup#/start/email).

A container image – The tutorial uses a simple NodeJS application container image hosted on [DockerHub](https://hub.docker.com/repository/docker/goodiec/nodeapp).

Related:[How to Create an HTTPS NodeJS Web Service with Express](https://adamtheautomator.com/https-nodejs/)

## What is Fargate AWS?

When you want the ease of serverless computing without the headache of managing servers, AWS Fargate is the perfect solution. But what is AWS Fargate anyway?

AWS Fargate is a serverless compute engine for containers that work with [AWS ECS](https://adamtheautomator.com/aws-ecs-tutorial/) and Amazon Elastic Kubernetes Service (EKS). AWS Fargate is a convenient way to deploy and manage containerized applications in the cloud without having to manage any servers.

With AWS Fargate, you only need a container image, and you can launch your container in no time.

Related:[Confidently Deploy Containers in this AWS ECS Tutorial](https://adamtheautomator.com/aws-ecs-tutorial/)

## Provisioning Workload for AWS Fargate

Before deploying or running a container image using AWS Fargate, you need a way that determines the infrastructure your tasks and services are hosted on. How? You must first create a cluster in AWS ECS using the [Fargate launch type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html).

To create a cluster, AWS ECS provides a step-by-step method as follows:

1\. Open your favorite web browser, and log in to the [AWS console](https://aws.amazon.com/console/).

2\. Next, search for ECS in the search bar, and click **Elastic Container Service** from the search results to access the ECS dashboard. ![Accessing the ECS dashboard](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/963da83f-e5ae-4bed-8a6a-a27e6da92227/search-ecs.png) Accessing the ECS dashboard

![Accessing the ECS dashboard](https://adamtheautomator.com/wp-content/uploads/2022/12/image-266.png)

Accessing the ECS dashboard

3\. On the ECS dashboard, click **Get started,** and your browser redirects to a wizard page (step four).

> 💡 _Note that if you have the [New ECS Experience](https://aws.amazon.com/blogs/containers/new-look-for-amazon-ecs-in-the-aws-management-console/) enabled, the pages will look different than the ones in this tutorial._

![Getting started with the Amazon ECS](https://adamtheautomator.com/wp-content/uploads/2022/12/image-267.png)

Getting started with the Amazon ECS

4\. Now, in the **Step1: Container and Task** tab, select **custom**, and click **Configure**. A pop-up window appears (right-most), where you can input details of your container image (step five).

![ECS Fargate deployment steps](https://adamtheautomator.com/wp-content/uploads/2022/12/image-268.png)

ECS Fargate deployment steps

5\. Edit the container details with the following:

*   **Container name** – Provide a descriptive name for your container. This tutorial uses the **nodeapp** container name.**Image** – Input your container image URI (_i.e., [docker.io/goodiec/nodeapp:v1](http://docker.io/goodiec/nodeapp:v1)_).**Port mappings** – Input the container port, which is **3000** for this tutorial.

Once configured, click **Update** (bottom-right) to save the changes.

![Configuring the container](https://adamtheautomator.com/wp-content/uploads/2022/12/image-269.png)

Configuring the container

6\. Back in the wizard page, scroll down to the **Task definition** section, and click **Edit** to make changes to the task definition.

![Editing the task definition](https://adamtheautomator.com/wp-content/uploads/2022/12/image-270.png)

Editing the task definition

7\. Edit the **Task definition name** (i.e., **nodeapp-task-definition**), leave the rest as default, click **Save** to save the changes, and close the pop-up window.

![Providing task definition name](https://adamtheautomator.com/wp-content/uploads/2022/12/image-271.png)

Providing task definition name

8\. Once saved, click **Next** to confirm the settings. Your browser redirects to a page where you will define your service.

![Continuing with the selected settings](https://adamtheautomator.com/wp-content/uploads/2022/12/image-272.png)

Continuing with the selected settings

9\. In the **Define your service** section, select the **Application Load Balancer** option as the load balancer type, leave the rest as default, and click **Next**.

This action creates an AWS Fargate-oriented ECS service, a specified number of tasks, and adds them to the load balancer’s target group.

![Defining the service](https://adamtheautomator.com/wp-content/uploads/2022/12/image-273.png)

Defining the service

10\. Scroll down to the **Configure your cluster** section, provide a **Cluster name** (i.e., nodeapp-cluster), and click **Next**.

The VPC and the subnets will be automatically created for the cluster.

![Configuring the cluster](https://adamtheautomator.com/wp-content/uploads/2022/12/image-274.png)

Configuring the cluster

11\. Review your selected settings/definitions (or click **Edit** on any section to make changes), and click **Create** to finalize creating the service.

![Reviewing the selected settings and creating the service](https://adamtheautomator.com/wp-content/uploads/2022/12/image-275.png)

Reviewing the selected settings and creating the service

12\. Lastly, click on **View service** to view the service details page after creating the service.

![Accessing the service details ](https://adamtheautomator.com/wp-content/uploads/2022/12/image-276.png)

Accessing the service details

Below, you can see the details of the created service, which is currently **ACTIVE**.

![Overviewing the service details](https://adamtheautomator.com/wp-content/uploads/2022/12/image-277.png)

Overviewing the service details

## Verifying the Container Deployment

You have successfully created the service, but how do you know the deployment works? First, you must get the public IP address or the DNS name of the load balancer, which you will use for this tutorial.

To get the DNS name of the load balancer:

1\. In the service page’s Details tab, click on the **Target Group Name** to access the target group. ![Accessing the target group](https://s3-us-west-2.amazonaws.com/secure.notion-static.com/4da8d942-c783-4527-9c4b-0aeb1ccc1b0a/load-balancing.png) Accessing the target group

![Accessing the target group](https://adamtheautomator.com/wp-content/uploads/2022/12/image-278.png)

Accessing the target group

2\. Next, click on the target group’s name from the table to view its details.

![Accessing the target group’s details](https://adamtheautomator.com/wp-content/uploads/2022/12/image-279.png)

Accessing the target group’s details

3\. On the target group’s details page, click on the load balancer hyperlink to access the load balancer details.

![Accessing the load balancer details](https://adamtheautomator.com/wp-content/uploads/2022/12/image-280.png)

Accessing the load balancer details

4\. Now, copy the **DNS name** from the table, as shown below.

![Copying the DNS name](https://adamtheautomator.com/wp-content/uploads/2022/12/image-281.png)

Copying the DNS name

5\. Open a new tab on your browser, and navigate to the DNS name you copied in the previous step.

Accessing the app using just the IP or DNS name returns the error shown below since the container port `3000` is listening or is only open for requests.

![Getting an error viewing the application](https://adamtheautomator.com/wp-content/uploads/2022/12/image-282.png)

Getting an error viewing the application

6\. Lastly, append the container port to the DNS name (i.e., _DNS\_Name:PORT_ or _IP\_Add:PORT_) to view the app, as shown below.

![Accessing the app with the container port appended](https://adamtheautomator.com/wp-content/uploads/2022/12/image-283.png)

Accessing the app with the container port appended

## Adding a Listener for Port-Forwarding

You have successfully accessed your deployment via the DNS name of the load balance. But appending the container port to the DNS name each time you access your deployment can be tedious. How do you fix it? By adding a listener to forward requests to the target group and allow inbound traffic.

Related:[Managing Standard and DNS Conditional Forwarder with PowerShell](https://adamtheautomator.com/dns-conditional-forwarder/)

To add a listener for port-forwarding, follow these steps:

1\. Navigate to the **Load balancers** page, and click on the load balancer name to access its details page.

![Accessing the load balancer name](https://adamtheautomator.com/wp-content/uploads/2022/12/image-285.png)

Accessing the load balancer name

2\. Next, scroll down to the **Listeners** tab, and click **Add listener** to initiate adding a listener.

![Initiating adding a listener](https://adamtheautomator.com/wp-content/uploads/2022/12/image-286.png)

Initiating adding a listener

3\. Under the **Listener details** section, input **80** as the **Port**, and select **Forward** from the **Default actions** dropdown field.

![Specifying the listener's details](https://adamtheautomator.com/wp-content/uploads/2022/12/image-287.png)

Specifying the listener’s details

4\. Now, select a target group associated with your ECS service on the **Target group** section that shows up, and click **Add**. This target group is where requests will be forwarded.

![Selecting the target group associated with the ECS service](https://adamtheautomator.com/wp-content/uploads/2022/12/image-288.png)

Selecting the target group associated with the ECS service

5\. Once added, click the load balancer name to go back to the load balancer’s details page.

![Verifying the listener is added successfully](https://adamtheautomator.com/wp-content/uploads/2022/12/image-289.png)

Verifying the listener is added successfully

6\. On the load balancer details page, hover your mouse over the **Not reachable** error message to see more about the error.

This error shows up because the load balancer’s security group does not allow traffic on the port you added (80).

![Viewing the listener error](https://adamtheautomator.com/wp-content/uploads/2022/12/image-290.png)

Viewing the listener error

7\. Navigate to the **Security** tab to access the security groups list, and click the **Security Group ID** from the list to view its details.

![Accessing the security group details](https://adamtheautomator.com/wp-content/uploads/2022/12/image-291.png)

Accessing the security group details

8\. Under the **Inbound rules** tab, click **Edit inbound rules** to configure the selected inbound rule.

![Editing the inbound rules](https://adamtheautomator.com/wp-content/uploads/2022/12/image-292.png)

Editing the inbound rules

9\. Click **Add rule** (lower-left), allow port **80** (HTTP traffic) from **Anywhere** and click on **Save rules** (bottom-right) to save the changes.

![Adding an inbound rule for port 80 ](https://adamtheautomator.com/wp-content/uploads/2022/12/image-293.png)

Adding an inbound rule for port 80

As shown below, you will see a success message if the rule is added successfully.

![Confirming the new inbound rule is successfully added](https://adamtheautomator.com/wp-content/uploads/2022/12/image-294.png)

Confirming the new inbound rule is successfully added

10\. Finally, navigate to the DNS name again without appending port 80, and you will get the same page as below.

![Accessing the application without appending port 80](https://adamtheautomator.com/wp-content/uploads/2022/12/image-295.png)

Accessing the application without appending port 80

## Conclusion

AWS Fargate is a convenient serverless infrastructure that can be used to deploy and run containers. And throughout this tutorial, you have learned containerizing and deploying applications without having to worry about server provisioning or management.

At this point, you can confidently get rid of unpredictable costs or underprovisioning resources.

Now, why not learn how AWS Fargate works with AWS CloudWatch for application and infrastructure monitoring? Take advantage of AWS Fargate now and enjoy the benefits of serverless infrastructure!

Related:[How to Install and Set Up an AWS CloudWatch Agent](https://adamtheautomator.com/cloudwatch-agent/)

Share this article

[Share on X](https://twitter.com/intent/tweet?url=https%3A%2F%2Fadamtheautomator.com%2Ffargate-aws%2F&text=Convenient%20Serverless%20Infrastructure%20via%20Fargate%20AWS)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fadamtheautomator.com%2Ffargate-aws%2F)[Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fadamtheautomator.com%2Ffargate-aws%2F)

## Related Posts

![](https://adamtheautomator.com/wp-content/uploads/2022/05/HMaster-Your-Data-with-AWS-Quicksight.jpg)

### [Make Data-Driven Decisions with AWS QuickSight Analytics](/aws-quicksight/)

Struggling to make sense of your data? Discover how AWS QuickSight transforms data into actionable insights for smarter decision-making.

![](https://adamtheautomator.com/wp-content/uploads/2023/11/aws-network-access-analyzer-2.jpg)

### [Getting Started with AWS Network Access Analyzer](/aws-network-access-analyzer/)

Unlock the power of AWS Network Access Analyzer. Master network security with step-by-step guidance in this tutorial today!

![](https://adamtheautomator.com/wp-content/uploads/2023/11/ngrok-remote.jpg)

### [Hosting an Ngrok Remote Web App on AWS](/ngrok-remote/)

Learn how to run the Ngrok remote web application on AWS with the FastAPI Python endpoint in Linux through this ATA Learning tutorial!

## Categories

*   [IT Ops](/category/it-ops/)
*   [Cloud](/category/cloud/)
*   [DevOps](/category/devops/)
*   [Home Ops](/category/home-ops/)
*   [Information Security](/category/infosec/)
*   [Software Development](/category/software-development/)

## Site

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Copyright 2026© ATA Learning | [Privacy Policy](/privacy/)
