Allocation strategies - Amazon Batch
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).

Allocation strategies

When a managed compute environment is created, Amazon Batch selects instance types from the instanceTypes specified that best fit the needs of the jobs. The allocation strategy defines behavior when Amazon Batch needs additional capacity. This parameter isn't applicable to jobs that run on Fargate resources. Don't specify this parameter.

BEST_FIT (default)

Amazon Batch selects an instance type that best fits the needs of the jobs with a preference for the lowest-cost instance type. If additional instances of the selected instance type aren't available, Amazon Batch waits for the additional instances to be available. If there aren't enough instances available, or if the user is reaching the Amazon EC2 service quotas, then additional jobs don't run until currently running jobs are complete. This allocation strategy keeps costs lower but can limit scaling. If you're using Spot Fleets with BEST_FIT, the Spot Fleet IAM Role must be specified. BEST_FIT isn't supported when updating compute environments. For more information, see Updating compute environments.

Note

Amazon Batch manages Amazon resources in your account. Compute environments with the BEST_FIT allocation strategy originally utilized launch configurations by default. However, the use of launch configurations with new Amazon accounts will be restricted over time. Therefore, beginning in late April 2024, newly-created BEST_FIT compute environments will default to launch templates. If your service role lacks permissions to manage launch templates, Amazon Batch may continue to utilize launch configurations. Existing compute environments will continue to use launch configurations.

BEST_FIT_PROGRESSIVE

Amazon Batch selects additional instance types that are large enough to meet the requirements of the jobs in the queue. Instance types with a lower cost for each unit vCPU are preferred. If additional instances of the previously selected instance types aren't available, Amazon Batch selects new instance types.

SPOT_CAPACITY_OPTIMIZED

Amazon Batch selects one or more instance types that are large enough to meet the requirements of the jobs in the queue. Instance types that are less likely to be interrupted are preferred. This allocation strategy is only available for Spot Instance compute resources.

SPOT_PRICE_CAPACITY_OPTIMIZED

The price and capacity optimized allocation strategy looks at both price and capacity to select the Spot Instance pools that are the least likely to be interrupted and have the lowest possible price. This allocation strategy is only available for Spot Instance compute resources.

Note

We recommend that you use SPOT_PRICE_CAPACITY_OPTIMIZED rather than SPOT_CAPACITY_OPTIMIZED in most instances.

The BEST_FIT_PROGRESSIVE and BEST_FIT strategies use On-Demand or Spot Instances, and the SPOT_CAPACITY_OPTIMIZED and SPOT_PRICE_CAPACITY_OPTIMIZED strategies uses Spot Instances. However, Amazon Batch might need to exceed maxvCpus to meet your capacity requirements. In this event, Amazon Batch never exceeds maxvCpus by more than a single instance.