Reputation: 359
What's the proper way to send part of a Step Function's input to a Batch Job?
I've tried setting and env var using Parameters.ContainerOverrides.Environment like this:
"Parameters": {
"ContainerOverrides": {
"Environment": [
{
"Name": "PARAM_1",
"Value": "$.param_1"
}
Step function input looks like this:
{
"param_1": "value-goes-here"
}
But the batch job just ends up getting invoked with literal "$.param_1" in the PARAM_1 env var.
Upvotes: 4
Views: 3630
Reputation: 369
Pass it in "Parameters" (within the parent "Parameters"). Please note all parameters values are strings
"MyStepTask": {
"Type": "Task",
"Resource": "arn:aws:states:::batch:submitJob.sync",
"Parameters": {
"JobDefinition": "myjobdef",
"JobName": "myjobname",
"JobQueue": "myjobqueue",
"Parameters": { "p_param1":"101",
"p_param2":"201"
}
},
"Next": "MyNextStepTask"
}
Upvotes: 2
Reputation: 33
If you're wanting to pass parameters to Batch add the Parameters section to the parent Parameters section (not great naming!)
"MyStepTask": {
"Type": "Task",
"Resource": "arn:aws:states:::batch:submitJob.sync",
"Parameters": {
"JobDefinition": "myjobdef",
"JobName": "myjobname",
"JobQueue": "myjobqueue",
"Parameters": {
"Name": "PARAM_1",
"Value.$": "$.param_1"
}
},
"Next": "MyNextStepTask"
}
Upvotes: 1
Reputation: 359
Fixed. The Value key simply needed the ".$" postfix.
"Parameters": {
"ContainerOverrides": {
"Environment": [
{
"Name": "PARAM_1",
"Value.$": "$.param_1"
}
Upvotes: 6