By using AWS re:Post, you agree to the AWS re:Post Terms of Use

AWS ECS Fargate_SPOT fall back to Fargate

0

Hello, I am planning to launch the ECS cluster (6 Tasks), using the following Capacity provider strategy over the Cluster level:

Weight Configuration: Set FARGATE-SPOT with a weight of 1 (primary choice for cost savings). Set FARGATE with a weight of 1, so it will take over if FARGATE-SPOT is unavailable.

Base Value: Set the base value to 0 for both providers. This value allows ECS to switch freely between FARGATE-SPOT and FARGATE depending on availability.

The idea is to launch all of them as (SPOT), and in case no capacity is available that will auto-launch FARGATE On-Demand. But, per AWS Community, there is no mechanism to fall back to the Fargate. https://repost.aws/knowledge-center/ecs-fargate-spot-capacity-provider#:~:text=When%20there%27s%20no,Share

The suggested solution is: To prioritize FARGATE_SPOT for all tasks and fall back to FARGATE only when Spot is unavailable, we can set the weights as follows: FARGATE_SPOT: Set a high weight, like 6, to strongly favor Spot. FARGATE: Set a weight of 1, so it only picks up tasks if Spot isn’t available.

In this setup: ECS will try to launch all 6 tasks on FARGATE_SPOT due to its high weight. If there’s not enough Spot capacity, ECS will fall back to placing some tasks on FARGATE.

Why base is 0 in both capacity providers? The base parameter is used to ensure a minimum number of tasks are always run on a specific capacity provider. That will let ECS guarantee that at least that N tasks will be launched on it, regardless of the weight values of other providers.

could you confirm my results? And if the weight is 1 for each type will work to fall back to Fargate?

2 Answers
0

... there is indeed a mechanism for ECS to fall back to Fargate on-demand when Fargate Spot capacity is unavailable

Where in the AWS Documentation is this "fallback mechanism" described? I've read all the referenced docs, and don't see anything suggestion that ECS will "fallback" to FARGATE when FARGATE-SPOT is unavailable.

answered 20 days ago
-1

Your understanding of the ECS capacity provider strategy is generally correct, but there are a few points to clarify and confirm.

First, it's important to note that there is indeed a mechanism for ECS to fall back to Fargate on-demand when Fargate Spot capacity is unavailable. The capacity provider strategy you've described can work to achieve this goal, but the effectiveness depends on the specific configuration.

Using equal weights of 1 for both FARGATE_SPOT and FARGATE can work, but it may not provide the strong preference for Spot instances that you're looking for. With equal weights, ECS will attempt to distribute tasks evenly between the two capacity providers. This means that even when Spot capacity is available, you might end up with a mix of Spot and on-demand instances.

The suggestion to use a higher weight for FARGATE_SPOT (like 6) and a lower weight for FARGATE (like 1) is a good approach. This configuration will strongly favor Spot instances while still allowing fallback to on-demand when necessary. With this setup, ECS will attempt to launch all tasks on Fargate Spot first, and only use Fargate on-demand if Spot capacity is unavailable.

Regarding the base value, your understanding is correct. Setting the base to 0 for both providers allows ECS to flexibly allocate tasks between the two capacity providers based on their weights and availability. This configuration doesn't guarantee a minimum number of tasks on either provider, which aligns with your goal of prioritizing Spot instances but falling back to on-demand when necessary.

To summarize:

  1. A fallback mechanism from Fargate Spot to Fargate on-demand does exist.
  2. Using equal weights of 1 for both providers will work, but may not strongly prioritize Spot instances.
  3. Using a higher weight for FARGATE_SPOT (e.g., 6) and a lower weight for FARGATE (e.g., 1) will better prioritize Spot instances while allowing fallback.
  4. Setting the base to 0 for both providers is appropriate for your use case.

Remember that the actual behavior may vary depending on the availability of Spot capacity at any given time. It's also worth noting that when using Fargate Spot, you should design your applications to be interruption-tolerant, as Spot instances can be reclaimed with only a two-minute warning.
Sources
AWS Fargate Spot compared to Reserved Instances - Prebid Server Deployment on AWS
Using Amazon EC2 Spot and FARGATE_SPOT - Amazon Elastic Container Service
Amazon ECS Capacity Providers Now Support Update Functionality
Amazon ECS capacity providers for the EC2 launch type - Amazon Elastic Container Service

profile picture
answered a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions