Michael Walz
Michael Walz

Reputation: 320

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?

Upvotes: 15

Views: 11080

Answers (3)

Ritisha - AWS
Ritisha - AWS

Reputation: 387

Unfortunately, API Gateway doesn't offer local testing/development solutions at the moment.

Upvotes: 4

Redtopia
Redtopia

Reputation: 5237

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

Upvotes: 21

Mitayshh Dhaggai
Mitayshh Dhaggai

Reputation: 89

To call the microservices locally a workaround could be to use Private integration on API Gateway which would use VPCLink. VPCLink will connect to services running within a VPC via NLB. For example, the setup would be API Gateway --> VPCLink Integration --> NLB --> EC2 instance (for example, acts as proxy) --> calls local service (VPC connects to local network via Direct connect)

Although a complicated setup but a possible workaround

Upvotes: 0

Related Questions