Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass Step Function input to Batch Job

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.

like image 917
Eric Avatar asked Oct 15 '25 07:10

Eric


2 Answers

Fixed. The Value key simply needed the ".$" postfix.

"Parameters": {
 "ContainerOverrides": {
  "Environment": [
    {
      "Name": "PARAM_1",
      "Value.$": "$.param_1"
    }
like image 86
Eric Avatar answered Oct 16 '25 22:10

Eric


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"
}
like image 29
Venkat.V.S Avatar answered Oct 16 '25 21:10

Venkat.V.S