'AWS: How to return the output of glue job in step function and pass that to new glue job as input?

After the step function starts executing the first step, which is glue job, I need to return the output that is inside the glue job. I need to pass it to another glue job in the step function below.

Issue: the glue job is returning the response in step function but it's having the status http headers,sdkmetadata,etc.... I need the data which is returning from the glue job. How do I pass it in the response which is returned from step function after running glue.

glue code is :

import json

import sys

lis = ["abc.txt","def.json"]

return lis

I need to return lis to next glue job through step function.

The code below is the json response that is returned after the glue job runs and passes it to next step:

{
  "name": "Lambda Invoke",
  "input": {
    "JobRunId": "jr_85abf745e3b6c0c349b2224412899f919b595b2a7221f0deb5b13d1c9866e6e1",
    "SdkHttpMetadata": {
      "AllHttpHeaders": {
        "Connection": [
          "keep-alive"
        ],
        "x-amzn-RequestId": [
          "79891b96-8700-4b14-8e9e-839f4e17b490"
        ],
        "Content-Length": [
          "82"
        ],
        "Date": [
          "Tue, 08 Feb 2022 11:33:15 GMT"
        ],
        "Content-Type": [
          "application/x-amz-json-1.1"
        ]
      },
      "HttpHeaders": {
        "Connection": "keep-alive",
        "Content-Length": "82",
        "Content-Type": "application/x-amz-json-1.1",
        "Date": "Tue, 08 Feb 2022 11:33:15 GMT",
        "x-amzn-RequestId": "79891b96-8700-4b14-8e9e-839f4e17b490"
      },
      "HttpStatusCode": 200
    },
    "SdkResponseMetadata": {
      "RequestId": "79891b96-8700-4b14-8e9e-839f4e17b490"
    },
    "JobName": "Test"
  },
  "inputDetails": {
    "truncated": false
  }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source