How to transform HTTP requests to Lambda events exactly as AWS API Gateway does as an HTTP proxy?

0

I'm developing a Lambda service behind an API Gateway as an HTTP proxy[1].

As the docs say, API Gateway basically transforms the HTTP request into a JSON Lambda Event.

In order to support the development process, I wonder if there is a library I could use to do that: transform an HTTP request into a JSON Lambda Event.

That way I could develop locally, wrapping my lambda implementation in a dummy web server whose work would be to transform and pass the event to my code.

[1] https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html

1 Answer
1

I recommends that you use SAM CLI for local testing. Using SAM CLI you can invoke your functions locally using the sam local start-api command, that will start also a local API gateway and will invoke your code when you CURL the local end-point. You could also use sam local generate-event to create the event object that is used by API Gateway and use it when invoking the function directly using sam local invoke.

profile pictureAWS
EXPERT
Uri
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions