Search code examples
amazon-web-servicesaws-glueaws-step-functions

Pass Input of Step Function to Glue JOb


I'm trying to pass input from step function to Glue Job. Following is my test state machine, enter image description here

This is the code I'm using

enter image description here

This is the input I' giving to state machine,

{ "Comment": "Insert your JSON here" }

Issue is that values are not passing to the Glue


Solution

  • The syntax that you are using is not valid. Please check below example or this link for more.

    GlueOrchestrationStateMachine:
            Type: "AWS::StepFunctions::StateMachine"
            Properties:
                RoleArn: !GetAtt StepFunctionsServiceRole.Arn
                DefinitionString: !Sub |-
                      {
                        "StartAt": "Glue StartJobRun",
                        "States": {
                          "Glue StartJobRun": {
                            "Type": "Task",
                            "Resource": "arn:aws:states:::glue:startJobRun.sync",
                            "Parameters": {
                              "JobName.$": "$.job_name",
                              "Arguments": {
                                  "--REGION.$": "$.arguments.region",
                                  "--TABLE_NAME.$": "$.arguments.table_name",
                                  "--S3_OUTPUT_BUCKET.$": "$.arguments.s3_output_bucket",
                                  "--S3_OUTPUT_KEY_PREFIX.$": "$.arguments.s3_output_key_prefix",
                                  "--DATABASE_NAME.$": "$.arguments.database_name"
                              }
                            },
                            "InputPath": "$",
                            "ResultPath": "$.status",
                            "Next": "Start Crawler",
                            "Catch": [
                                {
                                  "ErrorEquals": [ "States.ALL" ],
                                  "Next": "Job Failure"
                                }
                            ]
                          },
                          
                      }
                  }