AWS Certified Developer – Associate — Question 391
A serverless application is using AWS Step Functions to process data and save it to a database. The application needs to validate some data with an external service before saving the data. The application will call the external service from an AWS Lambda function, and the external service will take a few hours to validate the data. The external service will respond to a webhook when the validation is complete.
A developer needs to pause the Step Functions workflow and wait for the response from the external service.
What should the developer do to meet this requirement?
Answer options
- A. Use the .wait ForTaskToken option in the Lambda function task state. Pass the token in the body.
- B. Use the .waitForTaskToken option in the Lambda function task state. Pass the invocation request.
- C. Call the Lambda function in synchronous mode. Wait for the external service to complete the processing.
- D. Call the Lambda function in asynchronous mode. Use the Wait state until the external service completes the processing.
Correct answer: A
Explanation
Using the .waitForTaskToken service integration pattern allows Step Functions to pause execution until an external service returns the task token via the SendTaskSuccess or SendTaskFailure API. Passing the token in the payload ensures the webhook can retrieve and return it once the hours-long validation completes. Synchronous Lambda invocation is unsuitable because Lambda has a maximum execution timeout of 15 minutes, which is far shorter than the several hours required by the external service.