Human in the Loop (AWS CDK)

Wait for an approval from a human reviewer with one-click email approve/reject links

This pattern allows you to integrate a human review or approval process into your workflows with one-click email approval.
An AWS Lambda function sends an approval request via Amazon SNS email containing clickable approve/reject links. The task token is URL-encoded to avoid issues with special characters in Amazon API Gateway URLs.
The workflow pauses using the .waitForTaskToken service integration until the reviewer clicks an approve or reject link.
The link triggers an Amazon API Gateway endpoint backed by an AWS Lambda function that calls SendTaskSuccess or SendTaskFailure to resume the AWS Step Functions workflow.
Depending on the review outcome, a different processing path is followed.

< Back to all workflows

GitHub icon View this workflow on GitHub


Clone repo

git clone https://github.com/aws-samples/step-functions-workflows-collection/tree/main/human-in-the-loop-cdk/cd step-functions-workflows-collection/human-in-the-loop-cdk

Deploy

1. Bootstrap CDK, if needed: <code>cdk bootstrap aws://{your-aws-account-number}/{your-aws-region}</code>2. Deploy the stack: <code>cdk deploy --parameters ModeratorEmailAddress=your-email@example.com</code>


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

Delete the stack: cdk destroy.

Created by:

Yogesh Nain

Yogesh Nain

Yogesh is Cloud Support Engineer and SME of Lambda, API Gateway at Amazon Web Services.

Follow on LinkedIn