Amazon ECS capacity providers - 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 capacity providers

Amazon ECS capacity providers manage the scaling of infrastructure for tasks in your clusters. Each cluster can have one or more capacity providers and an optional capacity provider strategy. The capacity provider strategy determines how the tasks are spread across the cluster's capacity providers. When you run a standalone task or create a service, you either use the cluster's default capacity provider strategy or a capacity provider strategy that overrides the default one.

Capacity providers are available for tasks that run on Fargate or on Amazon EC2 instances. You cannot use capacity providers for tasks that run on external container instances (Amazon ECS Anywhere).

Capacity provider types

For Amazon ECS workloads that are hosted on Fargate, the following predefined capacity providers are available:

  • Fargate

  • Fargate Spot

For Amazon ECS workloads that are hosted on Amazon EC2 instances, you must create and maintain a capacity provider that consists of the following components:

  • A name

  • An Auto Scaling group

  • The settings for managed scaling and managed termination protection.

Capacity provider considerations

Consider the following when using capacity providers:

  • A capacity provider must be associated with a cluster before being specified in a capacity provider strategy.

  • When you specify a capacity provider strategy, the number of capacity providers that you can specify is limited to six.

  • You can't update a service using an Auto Scaling group capacity provider to use a Fargate capacity provider. The opposite is also the case.

  • In a capacity provider strategy, if no weight value is specified for a capacity provider in the console, then the default value of 1 is used. If using the API or Amazon CLI, the default value of 0 is used.

  • When multiple capacity providers are specified within a capacity provider strategy, at least one of the capacity providers must have a weight value that's greater than zero. Moreover, any capacity providers with a weight of zero aren't used to place tasks. If you specify multiple capacity providers in a strategy with all the same weight of zero, then any RunTask or CreateService actions using the capacity provider strategy fail.

  • In a capacity provider strategy, only one capacity provider can have a defined base value. If no base value is specified, the default value of zero is used.

  • A cluster can contain a mix of both Auto Scaling group capacity providers and Fargate capacity providers. However, a capacity provider strategy can only contain Auto Scaling group or Fargate capacity providers, but not both.

  • A cluster can contain a mix of services and standalone tasks that use both capacity providers and launch types. A service can be updated to use a capacity provider strategy rather than a launch type. However, you must force a new deployment when doing so.

  • When you use managed termination protection, you must also use managed scaling. Otherwise, managed termination protection doesn't work.