Run Amazon Batch workloads with Step Functions
You can integrate Step Functions with Amazon Batch to run batch computing workloads in the Amazon cloud. This page lists the supported
Amazon Batch APIs and provides an example Task
state to perform a batch-processing task.
To learn about integrating with Amazon services in Step Functions, see Integrating services and Passing parameters to a service API in Step Functions.
Key features of Optimized Amazon Batch integration
The Run a Job (.sync) integration pattern is available.
Note that there are no optimizations for the Request Response or Wait for a Callback with Task Token integration patterns.
The following includes a Task
state that submits an Amazon Batch job and waits
for it to complete.
{
"StartAt": "BATCH_JOB",
"States": {
"BATCH_JOB": {
"Type": "Task",
"Resource": "arn:aws:states:::batch:submitJob.sync",
"Parameters": {
"JobDefinition": "preprocessing",
"JobName": "PreprocessingBatchJob",
"JobQueue": "SecondaryQueue",
"Parameters.$": "$.batchjob.parameters",
"ContainerOverrides": {
"ResourceRequirements": [
{
"Type": "VCPU",
"Value": "4"
}
]
}
},
"End": true
}
}
}
Supported Amazon Batch APIs:
Parameters in Step Functions are expressed in PascalCase
Even if the native service API is in camelCase, for example the API action startSyncExecution
, you specify parameters in PascalCase, such as: StateMachineArn
.
IAM policies for calling Amazon Batch
The following example templates show how Amazon Step Functions generates IAM policies based on the resources in your state machine definition. For more information, see How Step Functions generates IAM policies for integrated services and Discover service integration patterns in Step Functions.
Because Amazon Batch provides partial support for resource-level access control, you must use "Resource": "*"
.