Deep Dive on AWS Batch with Amazon Elastic Compute Cloud
Tags: awsbatch, amazonec2, amazonecs, cloudwatch
Published: 2024-02-24 18:49:58

“ I have deep dive into the concept of batch job run. I checked for aws batch service which is a perfect solution for batch processing with job queue and job definition. Pricing of aws batch has no additional cost involved and only need to pay for ec2 instance for it.”

AWS Batch is a powerful service that allows you to run batch computing workloads on the AWS Cloud. It’s particularly useful for developers, scientists and engineers who need access to large amounts of compute resources.

The purpose of AWS Batch simplifies the process of configuring and managing the necessary infrastructure for batch computing tasks. It removes the undifferentiated heavy lifting, allowing you to focus on your workloads.

In this post, you will get to know how to create a aws batch with required parameters for ec2 instance. Here I have created aws batch with amazon ec2.

#Architecture Overview
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ciezne76esdi4zpzldju.png)
The architecture diagram shows the overall deployment architecture with data flow, aws batch, amazon ec2 and amazon ecs.

#Solution overview
The blog post consist of the following phases:
1. Create of AWS Batch with Compute Environment and Job Parameters
2. Output of Batch Job Run as EC2 Instance 

##Phase 1: Create of AWS Batch with Compute Environment and Job Parameters
1. Open the AWS Batch console and create a compute environment, job queue, job definition and job with required parameters like role, cpu, memory, instance type, vpc, container image, user and so on.. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d3z9kbbyydorfnqgj7kg.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/068egoyhfyuser69zkd9.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ph1hrugy5yer332v6ns8.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tipusaenbcsulowwy46n.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y72o2ev48jum7qjyrd94.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5di14p50436e27ei5ut0.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qoeprggbhn9qh7jnlpsy.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4xjpokrkmu1v9d0ciumq.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r1ee9htogi6lwes1ighr.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b3gg7d8t6s65h5kmac48.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nzuc1ra62nhhmurh4gnx.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bu0h8qjsgop8czoppf6u.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tcc9kevqtr927f8e6a2k.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uox1hfzvymg6sv1cyt02.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eal6rkmpyw9bwxzf75mc.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wmqvbl21w6ygebnr8qu1.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gfonowz5j8h0mz2kda7i.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z5tntjgk428x31d7nmdv.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wtukeomhhxeu4p3lm5vb.png)

##Phase 2: Output of Batch Job Run as EC2 Instance 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kkfgj066jxarwc6ruy0t.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cjq5mvbz86ks3lbgp4xi.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rjtzbpd17ri4kreq54jj.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o7pyvqriq0wf5affywrm.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ncscfw84odz2s7kry4pv.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mm540zhj5x85dwjs31cj.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0gmbdmbknggkgq1av48b.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rk72tqo8oxy1mpuwow99.png)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kijjif7z5l8g4kr7nc1r.png)

#Clean-up
Delete Compute Environment, Job Queue, Job Definition, Job, Cloudwatch log group, ECS Cluster.

#Pricing
I review the pricing and estimated cost of this example. 

Cost of AWS Batch = $0.0

Cost of Amazon EC2 = $0.22

Cost of Amazon Elastic Container Service = $0.0

Cost of Amazon Cloudwatch = $0.50

Total Cost = $0.72

#Summary
In this post, I showed “deep dive on aws batch with amazon elastic compute cloud”.

For more details on AWS Batch, Checkout Get started AWS Batch, open the [AWS Batch console](https://us-east-1.console.aws.amazon.com/batch/home?region=us-east-1#firstRun). To learn more, read the [AWS Batch documentation](https://docs.aws.amazon.com/batch/?icmpid=docs_homepage_compute).

Thanks for reading!

Connect with me: [Linkedin](https://www.linkedin.com/in/gargee-bhatnagar-6b7223114)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/38sdi4nsp89fnui8h7dk.png)