Batch queues, jobs and compute environments
A job instead of a server
Batch computing runs finite tasks without a person waiting for each result. Imagine converting 12 image files into thumbnails. Each worker reads one input, writes one output and exits. AWS Batch accepts containerized jobs, schedules them and can obtain compute capacity. A job definition describes how to run a task (image, command, resources and role); a job queue holds submitted jobs; a compute environment supplies execution capacity. Unlike an ECS service that maintains a desired number of running tasks, a completed batch job stays completed.
Trace the queue
A submitted job may wait for dependencies, then become RUNNABLE when ready, STARTING while its environment is prepared, RUNNING during execution and finally SUCCEEDED or FAILED. A RUNNABLE job is not necessarily running: inspect available capacity, job resource requirements, queue associations and service quotas. FIFO prioritizes submission order; fair-share policies distribute scheduling opportunities among share identifiers according to configured policy and usage. Neither promises a deadline. An array job uses a shared definition for many children; AWS_BATCH_JOB_ARRAY_INDEX selects the input. A dependent aggregation job waits for successful prerequisites. Sequential and N_TO_N array dependencies express different ordering patterns.
Choose the execution platform
Use Fargate for suitable independent container tasks when avoiding host management matters. EC2-backed Batch permits broader instance and accelerator choices; Spot can reduce compute rates but capacity may be interrupted. ECS Managed Instances is another documented managed capacity choice, including workloads needing capabilities beyond Fargate; Batch also supports EKS-backed environments. Check the exact job type, region, compute compatibility, IAM and quotas. Do not mix Fargate and EC2 environments in the same Fargate job queue. A short event-driven task within Lambda limits may suit Lambda; an always-on API suits an ECS service; a persistent customized machine may suit EC2. Batch adds queueing and job lifecycle management for finite workloads.
Practice: estimate slots
With 8 available vCPUs and 16 GiB RAM, a task needing 2 vCPUs and 3 GiB can fit at most four times under a simplified pooled-capacity model. Twelve identical ten-minute tasks need at least three waves, or 30 minutes excluding startup, queue delay, packing and retries. Real capacity is per host, not a single pool. Limit submissions and worker concurrency; give job roles access only to their required input/output prefixes. Predict what happens if one input is invalid: report failure rather than pretending that aggregation is complete.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Batch queues, jobs and compute environments — knowledge check
Reason about finite workloads and bounded scheduling using synthetic scenarios.
Which component describes container image and resource requirements?
A job is RUNNABLE for ten minutes. What can you conclude?
What fits twelve independent inputs with the same processing command?
Which model fits an always-on API?
How many tasks fit in the simplified 8-vCPU, 16-GiB pool with 2 vCPUs and 3 GiB per task?