AWS Batch has quickly become one of the most sought after ways to run batch computing in the cloud. It is an AWS-native method of running batch jobs without the need for third-party solutions. Moreover, with the option of a managed compute environment, you don’t need to worry about provisioning and scaling the underlying infrastructure.
In regards to cost, AWS batch service doesn’t incur any additional costs, you will, however, pay for the underlying resources you consume to store and run your batch jobs.
Running Batch Jobs for Minimum Cost and Maximum Elasticity
Whether you choose to use a managed or an unmanaged compute environment, an ECS Cluster is created in the background and your batch Jobs will execute as Stand Alone Tasks within it.
In a managed environment, AWS Batch manages the capacity and instance types of the environments compute resources, based on your definitions. The limitation is that you only have a binary choice between expensive On-Demand instances or Spot instances with no guaranteed SLA by AWS. In addition to that, AWS Batch does not upgrade the AMIs in a compute environment after it is created, and you are responsible for the guest OS management, (including updates and security patches) and any additional application software or utilities that you install on the compute resources.
Alternatively, you could choose to completely manage your own Compute Environments, in which case you are solely responsible to perform the heavy lifting of configuring your instances, provisioning them, scaling and connecting them to the underlying ECS cluster, which would increase overhead.
Luckily, there is a 3rd alternative. With the Spotinst Elastigroup Batch Integration, you can scale and register your ECS container instances in the most cost-efficient way by leveraging Spot instances, or you can use a blend of Spot and On-Demand, as well as utilize existing Reservations on the fly.
Moreover, the Spotinst ECS Autoscaler achieves high resource allocation by leveraging bin packing algorithms and smart instance type selection, driven by the job requirements. The result is the most efficient use of your infrastructure and further cost reduction.
In addition to that, Elastigroup can even keep your ECS optimized AMI up to date for you.
Elastigroup’s detailed ECS dashboard contains both high-level cluster information and insights into every container instance and service.
The overview tab provides you with cluster CPU and Memory allocation graphs, the number of running tasks over time, and a desired vs running task count for every service:
The instances tab allows you to drill down into every container instance and see it’s running services and tasks, as well as resource allocation breakdown.
System Process Flow
Once connected with your Batch Queue, the Spotinst ECS Autoscaler recognizes any runnable Jobs and launches the required compute resources, while selecting the right instance type and size for optimal utilization and cost-effectiveness.
Even after deployment, Elastigroup will continue monitoring your jobs and resources, and when the jobs complete, it will react and scale down the environment, in order to prevent idle resources.
Run your Batch jobs on Spot Instances today:
To get started with AWS Batch on Elastigroup, please follow these steps:
- Set up AWS Batch:
Start by creating your Compute environment, and for the compute environment type, choose “Unmanaged”.
- Locate the ECS cluster that was created by AWS Batch:
You can use the DescribeComputeEnvironments API operation to view the compute environment details.
- Complete the AWS Batch setup:
Configure your Job queue and Job definition, connecting your new “Unmanaged” Compute environment to the queue. If you have an existing Job queue, you can edit and connect it to your new Compute environment.
- Create your Elastgroup:
Head over to the Spotinst console and create a new Elastigroup, choosing the “Fargate/ECS” use case.
- Set up the integration:
In the Elastigroup configuration wizard, specify the ECS cluster from step 2, and choose which AWS Batch Job queues you want Elastigroup to run. See our documentation for more details.
- Run your workload:
Submit your AWS Batch Jobs to your Job queue and watch Elastigroup scale up and work its magic!