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 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.
With the Allocation Strategy:
BEST_FIT
(BF) - Amazon EC2 picks the least expensive instanceBEST_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.
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.