Skip to main content

Deploying a Task Using AWS Fargate

Hands-On Lab

 

Photo of Mark Richman

Mark Richman

AWS Training Architect II in Content

Length

00:30:00

Difficulty

Intermediate

How can we run containers without having to worry about servers and clusters? This is what AWS Fargate is about. It completely abstracts the underlying infrastructure, and you see each and every one of your containers as a single machine. In this hands-on AWS Learning Activity, you will be deploying a task using Fargate.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

Deploying a Task Using AWS Fargate

Introduction

How can we run containers without having to worry about servers and clusters? This is what AWS Fargate is about. It completely abstracts the underlying infrastructure, and you see each and every one of your containers as a single machine.

In this hands-on lab, we will deploy a task using Fargate.

Solution

Log in to the live AWS environment using the credentials provided. Make sure you're in the N. Virginia (us-east-1) region throughout the lab.

Create a Task Definition

  1. Navigate to Elastic Container Service (ECS).
  2. Click Task Definitions in the left-hand menu.
  3. Click Create new Task Definition.
  4. Select the Fargate launch type, and click Next step.
  5. Set the following values:
    • Task Definition Name: nginx
    • Task memory (GB): 0.5GB
    • Task CPU (vCPU): 0.25 vCPU
    • Click Add container, and set the following values:
      • Container name: nginx
      • Image: nginx:latest
      • Memory Limits (MiB): Soft limit, 300
      • Port mappings: 80, tcp
      • Leave the rest of the settings as the defaults
    • Click Add.
  6. Click Create.
  7. Click View task definition.

Run a Task

  1. On the Task Definition page, click Actions, and select Run Task.
  2. Set the following values:
    • Launch type: Fargate
    • Number of tasks: 1
    • Cluster VPC: Select the one listed
    • Subnets: Select one or both public subnets
    • Auto-assign public IP: ENABLED
  3. Click Run Task.
  4. When the task's Last status becomes RUNNING, click the task ID and copy its public IP.
  5. Paste it in a new browser tab, which should result in the "Welcome to nginx!" web page.

Conclusion

Congratulations on completing this hands-on lab!