Skip to main content
In this lesson we’ll walk through creating a Batch Transform job in Amazon SageMaker to run offline inference on a dataset stored in Amazon S3. Batch Transform is ideal when you already have a trained model and need to score many records at once (for example, a CSV with thousands of rows). Follow the numbered steps below to create, configure, and monitor a Batch Transform job.
The image shows the Amazon SageMaker AI console page, highlighting its features for building, training, and deploying machine learning models at scale. The sidebar includes options for model training, deployment, and data preparation.
  1. Choose the model and instance type
  • Select the model you previously created in SageMaker. This model will be hosted by the transform job for batch inference.
  • Choose an instance type that balances throughput and cost. Instance selection has a direct impact on job runtime and hourly cost.
  • If your model needs GPU acceleration, select a GPU instance family (for example, ml.g4dn.* or ml.p3.*). For CPU inference, pick an ml.m5.* or similar instance.
Recommended instance choices and typical use cases:
This image shows a dropdown menu in the AWS SageMaker console for selecting instance types. Various instance options like "ml.m5.large" and "ml.m5.xlarge" are visible.
Instance sizing example: ml.m5.xlarge provides 4 vCPUs and 16 GiB memory, while ml.m5.large provides 2 vCPUs and 8 GiB memory. Pricing varies by region; always confirm current costs on the SageMaker pricing page before launching jobs.
  1. Review instance specifications and pricing
  • Verify vCPU, memory, and estimated hourly price for the instance class you selected.
  • Choose the smallest instance or smallest cluster of instances that meets your performance goals to reduce costs.
  • Consider parallelism: using multiple instances or larger instances may finish jobs faster but can increase total cost if not optimized.
The image shows a web page from Amazon SageMaker's pricing section displaying various instance types, their specifications in terms of vCPUs and memory (GiB), and corresponding hourly prices.
  1. Configure input data (S3)
  • Batch Transform reads input objects from S3. Configure the following fields:
    • S3 input URI: the S3 path or prefix containing your input files (for example, s3://your-bucket/raw-data/titanic.csv).
    • Split type: determines how SageMaker splits input files into invocation payloads. Use Line for typical CSVs where each line is one record; use None if the model expects the entire file as a single payload.
    • Compression: set to None unless your files are compressed.
    • Content type: set to text/csv, application/jsonlines, etc., to match your model input formatter.
  • Example: if your Titanic dataset is in S3, copy the input URI such as s3://.../raw-data/titanic.csv and paste it into the input location field.
Best practices:
  • Use one record per line (Line) for large CSVs so records are processed independently.
  • Partition large datasets into multiple objects to allow parallel processing by multiple instances.
The image shows the Amazon S3 web interface with a bucket named "raw-data" containing two objects: "titanic.csv" and a folder named "titanic/".
  1. Configure output location
  • Set an S3 output prefix where Batch Transform writes predictions (for example, s3://your-bucket/predictions/ or s3://your-bucket/processed/).
  • Use separate prefixes for intermediate/processed output and final predictions to keep raw and derived data organized.
  1. Additional configuration options
  • Accept header: request a particular response content type for output (for example, application/jsonlines).
  • Logging & buckets: optionally specify alternate buckets or prefixes for logs and job outputs.
  • Input/Output filters and JoinSource:
    • Use input/output filters when you need to transform or filter record fields before sending to the model or after receiving predictions.
    • Use JoinSource to include input record fields alongside the model’s prediction in the final output if you want joined results.
  • If your data is already clean and self-contained, these optional settings can usually be left unset.
The image is a screenshot of the AWS SageMaker console showing a form for creating a batch transform job, including options for configuration and environment variables.
  1. Launch and monitor
  • After selecting the model, instance type, and input/output paths and configuring optional settings, create the Batch Transform job.
  • Monitor job status from the SageMaker console under Inference → Batch transform jobs.
  • When the job completes, download and inspect the output files in the S3 output prefix you provided.
Monitoring tips:
  • Check the job status and logs in the SageMaker console.
  • Use Amazon CloudWatch for detailed logs and metrics (invocations, errors, instance utilization).
  • If results look incorrect, inspect the content-type, split type, and any input filters to ensure inputs match model expectations.
Be mindful of cost: long-running or large Batch Transform jobs can incur significant charges. Terminate or delete any resources (models, endpoints, or unused S3 objects) you no longer need to avoid ongoing costs.
Checklist before launching Further reading and references That’s it — you’ve configured and launched a Batch Transform job in SageMaker. Monitor the job, inspect the outputs in S3, and optimize instance sizing or input partitioning as needed to balance cost and throughput.

Watch Video