LinuxCommandLibrary

aws-batch

Run batch computing workloads on AWS

TLDR

List running batch jobs

$ aws batch list-jobs --job-queue [queue_name]
copy

Create compute environment
$ aws batch create-compute-environment --compute-environment-name [compute_environment_name] --type [type]
copy

Create batch job queue
$ aws batch create-job-queue --job-queue-name [queue_name] --priority [priority] --compute-environment-order [compute_environment]
copy

Submit job
$ aws batch submit-job --job-name [job_name] --job-queue [job_queue] --job-definition [job_definition]
copy

Describe the list of batch jobs
$ aws batch describe-jobs --jobs [jobs]
copy

Cancel job
$ aws batch cancel-job --job-id [job_id] --reason [reason]
copy

SYNOPSIS

aws batch SUBCOMMAND [GLOBAL-OPTIONS] [SUBCOMMAND-OPTIONS]

PARAMETERS

--help (-h)
    Display help for the command

--version
    Display version information

--debug
    Enable debug logging

--endpoint-url URL
    Override default service endpoint

--region REGION
    AWS region (e.g., us-east-1)

--output (or -o) FORMAT
    Output format: json|text|table

--profile PROFILE
    Named profile from credentials file

--query QUERY
    JMESPath expression to filter output

--cli-input-json FILE
    Read input from JSON file

--generate-cli-skeleton [v2]
    Output JSON skeleton for input

--cli-binary-format FORMAT
    Binary format for Base64 (CLI v2)

--no-paginate
    Disable automatic pagination

--only-show-errors
    Show only error messages

--no-cli-pager
    Disable cli pager for output

--no-validate-parameters
    Disable parameter validation

DESCRIPTION

The aws batch command is part of the AWS Command Line Interface (CLI) for interacting with AWS Batch, a fully managed service that handles batch computing jobs at scale without provisioning infrastructure. It supports submitting jobs, managing compute environments (EC2 or Fargate), job queues, and job definitions, as well as listing, describing, and terminating jobs.

AWS Batch automatically scales compute resources, supports containerized workloads via Docker, array jobs, job dependencies, and multi-node parallel jobs. Ideal for high-throughput tasks like data processing, simulations, financial modeling, and ML training. The CLI integrates with ECR for images, S3 for storage, CloudWatch for logs/metrics, and IAM for security.

Operations require AWS credentials and Batch-specific permissions. Output formats include JSON, text, or table; JMESPath queries filter results. JSON skeletons aid complex inputs. Use in scripts, CI/CD (e.g., Jenkins), or automation for efficient batch orchestration.

CAVEATS

Requires AWS CLI v2+ installed and configured credentials (via aws configure). IAM policies must grant Batch permissions. Rate limits apply; use --no-paginate for small outputs. Subcommand-specific validation errors common without proper JSON inputs.

COMMON SUBCOMMANDS

submit-job, list-jobs, describe-jobs, create-job-queue, create-compute-environment, register-job-definition. Run aws batch help for full list and details.

EXAMPLE USAGE

aws batch submit-job --job-name myjob --job-queue myqueue --job-definition mydef
aws batch list-jobs --job-queue myqueue --status RUNNABLE

HISTORY

Launched October 2016 with AWS Batch service. Integrated into AWS CLI v1 (2013 base), enhanced in v2 (2020) with binary JSON support, faster execution. Ongoing updates align with Fargate, ECS improvements.

SEE ALSO

aws(1)

Copied to clipboard