Amazon API Gateway to AWS Step Functions

API Gateway HTTP API → Step Functions

Create an API Gateway HTTP APIs endpoint that starts a Step Functions syncronous Express Workflow

This pattern explains how to deploy an API Gateway HTTP API that synchronously invokes a Step FunctionsExpress Workflow and returns the output state of the workflow in the HTTP request response body. The CDK application also creates a log group that Step Functions writes execution data into.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/apigw-sfn-cdk

Deploy

cdk deploy


Testing

Run the following command to send an HTTP `POST` request to the HTTP APIs endpoint. Note, you must edit the {HelloWorldApi} placeholder with the URL of the deployed HTTP APIs endpoint. This is provided in the stack outputs:
curl --location --request POST '{HelloWorldApi}' --header 'Content-Type: application/json' --data-raw '{ "IsHelloWorldExample": "Yes" }'

Cleanup

1. Delete the stack: cdk destroy.
2. Confirm the stack has been deleted: aws cloudformation list-stacks --query "StackSummaries[?contains(StackName,'STACK_NAME')].StackStatus"

Created by:

James Eastham

James Eastham

I am a Cloud Infrastructure Architect with AWS Professional Services.