简体   繁体   中英

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?

I found the answer myself.

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

You need to add a.$ after the key

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM