Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Api Gateway local testing/development

We've got dockerized microservices in AWS, all behind an API Gateway and accessible via REST. Authentication is managed by the API Gateway.

Is there any possibility to test those REST-microservices on a local machine (including authentication/api gateway logic)? Is there a possibility to make the API Gateway echo back the requests to my local machine and to call the microservices running locally? What is best practice for testing API Gateway managed authentication locally?

Thanks!

like image 915
Michael Walz Avatar asked Jul 26 '17 09:07

Michael Walz


People also ask

How do I test AWS serverless locally?

You can use AWS SAM with a variety of AWS toolkits and debuggers to test and debug your serverless applications locally. For example, you can perform local step-through debugging of your Lambda functions by setting breakpoints, inspecting variables, and executing function code one line at a time.

How do I run AWS CDK locally?

You can use the AWS SAM CLI to locally test your AWS CDK applications by running the following commands from the project root directory of your AWS CDK application: sam local invoke. sam local start-api. sam local start-lambda.


1 Answers

To use the AWS API Gateway locally, spin up SAM locally using the SAM CLI. There are however limits to what you can do with SAM, so you may not be able to do what you need to do locally. For example, websockets are still not supported (as of Sept 2020) as far as I know.

Instead of voting this answer down, please add a comment to provide other important information.

SAM stands for Serverless Application Model. See the Quickstart Guide for Developing Serverless Apps using SAM.

Other links:

Running API Gateway Locally

AWS CLI (required to run the SAM CLI)

Install the SAM CLI

SAM CLI Reference

like image 94
Redtopia Avatar answered Sep 28 '22 20:09

Redtopia