'How do I get a variable to be passed across into the next Step, in AWS Step Functions?

I have a very simple step function.

Start -> Lambda Function -> DynamoDB PutItem -> End

The Lambda Function Exports This:

{ 
  "statusCode": 200,
  "responseTime": 0.5
}

This data is sent to DynamoDB:PutItem

API Parameters of DynamoDB:PutItem

{
    "TableName": "MyTable",
    "Item": {
        "statusCode": {
          "S": "$.statusCode"
        }
    }
}

The issue is with $.statusCode this is wrong as it just inputs the actual string "$.statusCode" instead of its value.

How do I pass across the statusCode from my Lambda function to this next step?



Solution 1:[1]

I found the answer myself.

{
    "TableName": "MyTable",
    "Item": {
        "statusCode": {
          "S.$": "$.statusCode"
        }
    }
}

You need to add a .$ after the key

Sources

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

Source: Stack Overflow

Solution Source
Solution 1 James Wilson