Dynamic REST API

REST API Gateway asynchronously integrates with Express Step Functionsand put/get/delete items from a DynamoDB table

Amazon API Gateway integrate with AWS Step Functions as the backend, specifically Synchronous Express Workflows. Synchronous Express Workflows start a workflow and wait until it completes, then return the result.This workflow implements integrating a REST API with a Synchronous Express State machine that calls DynamoDB APIs to either store, retrieve or delete an Item from a table.
Invoking the endpoint with GET, POST, DELETE HTTP methods (any HTTP method can be set), will send the request to the state machine as a new execution. State machine make a choice based on input`’s “http Method” and calls one of DynamoDB PutItem, GetItem or DeleteItem APIs accordingly.
On success, an HTTP code 200 is returned with the execution output as the Response Body. The response from the invocation contains only the output field from the StartSyncExecution API. In case of failures, the fields error and cause are returned as part of the response.

< 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/dynamic-rest-api/cd step-functions-workflows-collection/dynamic_rest_api

Deploy

cdk deploy


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

1. Delete the stack: cdk destroy.

Created by:

Asma Hemmati

Asma is a Cloud Infrastructure Architect at Amazon Web Services (AWS) based in Munich, Germany.

Follow on LinkedIn