Skip to main content

AWS Batch

Running batch jobs at any scale: compute environments, job queues, job definitions, array and multi-node parallel jobs, Fargate or EC2 and Spot, retries and scheduling, security, cost, and monitoring.

6 min read · Last reviewed · SAA-C03

Loading your progress

Sign in to bookmark tutorials and track what you have read.

On this page

What it is

AWS Batch runs batch computing jobs: units of work that start, run to completion, and stop, such as simulations, rendering frames, genomics pipelines, financial risk models, or nightly data processing. You submit jobs to a queue, and Batch provisions the right amount of compute, runs each job in a container, and scales the compute back down when the queue is empty.

Without it, you would build and run your own scheduler and cluster. With it, there is no batch software to install or servers to manage, and you pay only for the compute the jobs use.

Components

Component What it is
Job A unit of work, such as a shell script, an executable, or a container image, submitted to a queue
Job definition The blueprint for jobs: container image, vCPU and memory, environment variables, an IAM role for the job, retry strategy, and timeout
Job queue Where jobs wait until they are scheduled. Queues have a priority, and each queue maps to one or more compute environments in order
Compute environment The compute that runs jobs: managed (Batch scales it for you) or unmanaged (you manage the instances)
Scheduling policy Optional fair-share scheduling between users or workloads; without one, a queue runs jobs FIFO (First in, first out)Processing items in the order they arrived. Amazon SQS FIFO queues keep messages in order within a message group and remove duplicates.Glossary entry

A common design is a high-priority queue for urgent jobs on On-Demand capacity and a low-priority queue on cheaper Spot capacity for work that can wait.

Compute options

  • AWS Fargate: no instances at all. AWS recommends Fargate for most jobs; jobs start in about 30 seconds instead of the minutes an EC2 instance takes to launch.
  • Amazon EC2 On-Demand or Spot Instances: choose EC2 when jobs need GPU (Graphics processing unit)A processor with thousands of small cores that run many calculations in parallel. GPUs speed up machine learning, graphics, and video work; EC2 instance families such as P and G include them.Glossary entry, a custom AMI (Amazon Machine Image)A template for launching EC2 instances: the operating system, software, and settings to copy onto the new instance's volumes, plus who may launch it. AMIs come from AWS, AWS Marketplace, or the community, or you create your own from an instance.Glossary entry, more than 32 vCPUs or 244 GiB of memory, or when you run very large numbers of jobs: AWS Batch dispatches jobs to EC2 faster than to Fargate, and more jobs can run at once without hitting Fargate's ThrottlingLimiting how many requests a client can make in a period. A throttled request is rejected, often with HTTP status 429 or a throttling error, and should be retried later with backoff.Glossary entry quotas.
  • Batch can also run jobs on Amazon EKS clusters, and can queue SageMaker AI training jobs.

For EC2, an allocation strategy picks instance types: BEST_FIT_PROGRESSIVE for On-Demand, and SPOT_PRICE_CAPACITY_OPTIMIZED (recommended) for Spot, which favors pools least likely to be interrupted.

Types of jobs

  • Array jobs run the same job many times, from 2 to 10,000 child jobs, each with its own index. They suit parametric sweeps, Monte Carlo simulations, and rendering.
  • Job dependencies make a job wait for others to finish, including sequential or index-to-index dependencies between array jobs.
  • Multi-node parallel jobs run one job across several EC2 instances that talk to each other, for tightly coupled HPC (High performance computing)Using many powerful computers together on large problems, such as simulations, genomics, or weather forecasting, often with fast networking between them. On AWS it uses EC2 instances with Elastic Fabric Adapter, AWS Batch, and AWS ParallelCluster.Glossary entry (MPI) and distributed GPU training.

Security, resilience, performance, and cost

Security

  • Give each job only the permissions it needs through the IAM role in its job definition. Batch itself uses a service-linked role, and EC2 compute environments use an ECS instance role.
  • Compute environments run in your VPC SubnetA range of IP addresses in a VPC, inside one Availability Zone. A subnet is public when its route table sends internet traffic to an internet gateway, and private when it does not.Glossary entry with your Security groupA stateful virtual firewall for network interfaces, such as an EC2 instance's, whose rules can only allow traffic. Return traffic for allowed connections is allowed automatically, and a rule can refer to another security group instead of IP addresses.Glossary entry, so jobs can reach private resources such as databases without the internet.

Resilience

  • A retry strategy retries failed jobs automatically, from 1 to 10 attempts, and evaluateOnExit decides which failures to retry, for example retrying when a Spot Instance is reclaimed but not when the application exits with an error.
  • A timeout stops jobs that run too long.
  • Compute environments can span several AZ (Availability Zone)An isolated location within an AWS Region, made up of one or more data centers with their own power, cooling, and networking. The AZs in a Region are linked by fast, low-latency connections, so spreading resources across them protects against the failure of one site.Glossary entry, and a queue can fall back to the next compute environment in its list.
  • For Spot, design jobs to checkpoint progress, so a retried job doesn't start from the beginning.

Performance

  • Batch scales compute between the minimum and maximum vCPUs you set, based on the jobs waiting in the queue.
  • Use array jobs instead of submitting thousands of separate jobs, and multi-node parallel jobs for work that must run across instances at once.

Cost

  • AWS Batch has no additional charge; you pay for the EC2 instances, Fargate resources, or other resources your jobs use.
  • Use Spot for Fault toleranceThe ability of a system to keep working without interruption when a component fails, because enough redundant capacity is already running. It goes further than high availability, which may allow a short failover.Glossary entry jobs, set the minimum vCPUs to 0 so idle compute scales away, and use Savings Plans for steady usage.

Monitoring

  • Amazon EventBridge receives job state change events, for example when a job moves from RUNNING to FAILED, so a rule can alert someone or start the next step.
  • Job output goes to Amazon CloudWatch Logs.
  • AWS CloudTrail records Batch API (Application programming interface)A defined way for one program to ask another for data or actions, such as a set of HTTPS requests and responses. Every AWS service is controlled through its API, which the console, the CLI, and the SDKs call for you.Glossary entry calls.

AWS Batch or another service?

If the requirement is Choose
Run large numbers of containerized batch jobs with queues, priorities, and Spot AWS Batch
Short Event-driven architectureA design in which services react to events that other services emit, such as an order placed or a file uploaded, instead of calling each other directly. Amazon EventBridge, Amazon SNS, Amazon SQS, and AWS Lambda are common building blocks.Glossary entry tasks of up to 15 minutes AWS Lambda
Coordinate the steps of a workflow, with branching and human approval AWS Step Functions (it can submit Batch jobs and wait for them)
Big data processing with Spark or Hadoop Amazon EMR or AWS Glue
A long-running service whose load changes EC2 with Auto Scaling, or containers on ECS or EKS

Reverse mindmap: when the question points here

Is it AWS Batch?
  • Yes, when the question says
    • Thousands of batch jobs, no scheduler to manage leads to AWS Batch
    • Jobs wait in a queue until compute is free leads to Job queue
    • Urgent jobs ahead of routine jobs leads to Higher-priority job queue
    • Same job over 10,000 inputs leads to Array job
    • Tightly coupled HPC across instances leads to Multi-node parallel job
  • Choose the compute
    • Fastest start, no instances leads to Fargate compute environment
    • Jobs need GPUs or a custom AMI leads to EC2 compute environment
    • Lowest cost, jobs can be retried leads to Spot with SPOT_PRICE_CAPACITY_OPTIMIZED
  • Run it reliably
    • Retry jobs interrupted by Spot leads to Retry strategy with evaluateOnExit
    • Alert when a job fails leads to EventBridge rule on job state change
  • No, when the question says
    • Each task runs under 15 minutes on events leads to AWS Lambda
    • Spark or Hadoop processing leads to Amazon EMR
    • Workflow with branching and approval leads to AWS Step Functions

Key takeaways

  • Batch runs containerized jobs that run to completion, with queues, priorities, and dependencies, and no scheduler to manage.
  • Job definitions describe jobs; job queues hold them; compute environments run them.
  • Fargate is recommended for most jobs; EC2 for GPUs, custom AMIs, or very large jobs; Spot for the lowest cost.
  • Array jobs (up to 10,000 children) and multi-node parallel jobs cover parallel workloads.
  • Batch itself is free; retries, timeouts, and EventBridge events keep it reliable and observable.

Sources

Check your understanding

Loading your quiz progress

Sign in to check your understanding with 15 questions on AWS Batch.

Glossary Install the app

LetMeMaster is an independent educational project and is not affiliated with or endorsed by Amazon Web Services. Practice results do not predict actual exam outcomes.

© 2026 LetMeMaster. All rights reserved. Content may not be copied or redistributed without permission.

Proudly made in Canada

Add LetMeMaster to your Home Screen

  1. Tap the Share button in your browser's toolbar. In Safari it is at the bottom of the screen, or at the top on iPad.
  2. Scroll down and tap Add to Home Screen.
  3. Tap Add. Open LetMeMaster from its icon on your Home Screen.