andy318
andy318

Reputation: 542

How do I create and use a parameterized AWS State Machine that takes in a delay timestamp and a payload to call a Lambda function?

I am looking to create a state machine containing 2 Step functions like so:

Start
 -> Wait (Timestamp value is passed into state machine)
 -> Call Lambda function with payload (also passed into state machine)
End

The purpose is to let a lambda function (nodeJS) schedule another function to be called at some time in the future. The timestamp and the payload would be passed into the state machine as part of scheduling this execution.

I'm unable to find a decent resource describing such a flow.

Upvotes: 0

Views: 585

Answers (1)

Pooya Paridel
Pooya Paridel

Reputation: 1391

You can select the value of "expirydate" from the input using a reference path to select it from the input data.

"wait_until" : {
    "Type": "Wait",
    "TimestampPath": "$.expirydate",
    "Next": "NextState"
}

Ref: https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-wait-state.html

Upvotes: 1

Related Questions