f. Instance Provisioning and Allocation Strategies

In the previous step, we have seen how instances are requested by AWS Batch, but not how they are provisioned. In this step, you will explore instance provisioning and allocation strategies.

Instance Provisioning

Instance provisioning is handled by Amazon EC2, it picks instances based on the list generated by AWS Batch and the Allocation Strategy selected when configuring your Compute Environment.

Allocation Strategies

With the Allocation Strategy:

  • BEST_FIT (BF) - Amazon EC2 picks the least expensive instance
  • BEST_FIT_PROGRESSIVE (BFP) - Amazon EC2 picks the least expensive instances and picks additional instance types if the previously selected types are not available.
  • SPOT_CAPACITY_OPTIMIZED (SCO) - Amazon EC2 Spot selects instances that are less likely to see interruptions.

Instance provisioning is directed by one or more Auto-Scaling groups or a Spot Fleet depending on the purchasing model selected. If using BEST_FIT and the Spot purchasing model, AWS Batch uses a Spot Fleet which can contain differing instance types. If using BEST_FIT and the On-Demand purchasing model, one ASG is used per instance type. For BEST_FIT_PROGRESSIVE and SPOT_CAPACITY_OPTIMIZED, a single ASG is used to provision all the instances for a Compute Environment regardless of the purchasing model. From a performance or behavior perspective, there’s no major difference between these approaches.

To explore the compute environment

  1. Open the AWS Batch console to see the AWS Batch Dashboards (link)
  2. Observe the provisioning model and instance types chosen for the Compute environment.
  3. Choose the compute environment. job submission
  4. Review the details about the compute environment built by the Batch CloudFormation stack. job submission

Next Steps:

Now that you understand the AWS Batch job lifecycle and how instances ar provisioned, in the next section we will talk a bit about optimization of your AWS Batch workload.