Amazon ECS on Amazon Fargate - Amazon Elastic Container Service
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Amazon ECS on Amazon Fargate

Amazon Fargate is a technology that you can use with Amazon ECS to run containers without having to manage servers or clusters of Amazon EC2 instances. With Amazon Fargate, you no longer have to provision, configure, or scale clusters of virtual machines to run containers. This removes the need to choose server types, decide when to scale your clusters, or optimize cluster packing.

When you run your tasks and services with the Fargate launch type, you package your application in containers, specify the CPU and memory requirements, define networking and IAM policies, and launch the application. Each Fargate task has its own isolation boundary and does not share the underlying kernel, CPU resources, memory resources, or elastic network interface with another task. You configure your task definitions for Fargate by setting the requiresCompatibilities task definition parameter to FARGATE. For more information, see Launch types.

Fargate offers platform versions for Amazon Linux 2 and Microsoft Windows 2019 Server Full and Core editions. Unless otherwise specified, the information on this page applies to all Fargate platforms.

This topic describes the different components of Fargate tasks and services, and calls out special considerations for using Fargate with Amazon ECS.

For information about the Regions that support Linux containers on Fargate, see Linux containers on Amazon Fargate.

For information about the Regions that support Windows containers on Fargate, see Windows containers on Amazon Fargate.

Fargate walkthroughs

For information about how to get started using the console, see:

For information about how to get started using the Amazon CLI, see:

Capacity providers

The following capacity providers are available:

  • Fargate

  • Fargate Spot - Run interruption tolerant Amazon ECS tasks at a discounted rate compared to the Amazon Fargate price. Fargate Spot runs tasks on spare compute capacity. When Amazon needs the capacity back, your tasks will be interrupted with a two-minute warning. For more information, see Amazon Fargate capacity providers.

    You can only use Fargate Spot for Linux tasks that use the X86 architecture.

Task definitions

Tasks that use the Fargate launch type don't support all of the Amazon ECS task definition parameters that are available. Some parameters aren't supported at all, and others behave differently for Fargate tasks. For more information, see Task CPU and memory.

Platform versions

Amazon Fargate platform versions are used to refer to a specific runtime environment for Fargate task infrastructure. It is a combination of the kernel and container runtime versions. You select a platform version when you run a task or when you create a service to maintain a number of identical tasks.

New revisions of platform versions are released as the runtime environment evolves, for example, if there are kernel or operating system updates, new features, bug fixes, or security updates. A Fargate platform version is updated by making a new platform version revision. Each task runs on one platform version revision during its lifecycle. If you want to use the latest platform version revision, then you must start a new task. A new task that runs on Fargate always runs on the latest revision of a platform version, ensuring that tasks are always started on secure and patched infrastructure.

If a security issue is found that affects an existing platform version, Amazon creates a new patched revision of the platform version and retires tasks running on the vulnerable revision. In some cases, you may be notified that your tasks on Fargate have been scheduled for retirement. For more information, see Amazon Fargate task maintenance FAQs.

For more information see Fargate Linux platform versions and Fargate Windows platform versions.

Service load balancing

Your Amazon ECS service on Amazon Fargate can optionally be configured to use Elastic Load Balancing to distribute traffic evenly across the tasks in your service.

Amazon ECS services on Amazon Fargate support the Application Load Balancer and Network Load Balancer load balancer types. Application Load Balancers are used to route HTTP/HTTPS (or layer 7) traffic. Network Load Balancers are used to route TCP or UDP (or layer 4) traffic. For more information, see Distribute Amazon ECS service traffic using load balancing.

When you create a target group for these services, you must choose ip as the target type, not instance. This is because tasks that use the awsvpc network mode are associated with an elastic network interface, not an Amazon EC2 instance. For more information, see Distribute Amazon ECS service traffic using load balancing.

Using a Network Load Balancer to route UDP traffic to your Amazon ECS on Amazon Fargate tasks is only supported when using platform version 1.4 or later.

Usage metrics

You can use CloudWatch usage metrics to provide visibility into your accounts usage of resources. Use these metrics to visualize your current service usage on CloudWatch graphs and dashboards.

Amazon Fargate usage metrics correspond to Amazon service quotas. You can configure alarms that alert you when your usage approaches a service quota. For more information about Amazon Fargate service quotas, see Amazon Fargate service quotas.

For more information about Amazon Fargate usage metrics, see Amazon Fargate usage metrics in the Amazon Elastic Container Service User Guide for Amazon Fargate.