Creating Mock Rest Service within API Gateway

REST services and architectures are becoming increasingly popular. Their simplicity and clarity are making developer’s lives much easier. Because of this, it is common to have the need to mock rest services.

Recently, I worked on a project and, at some point, we needed to mock up some Rest Services. We started exploring API Gateway; specifically, looking for a way to create mock services. After some tests, it was clear that API Gateway offers a very simple and highly customizable approach for testing scenarios.

I will not cover all the use cases and customizations that API Gateway features. Instead, this is just a simple guide that shows how to mock a Rest service in 5 minutes. I hope this can be used as a quick introduction to API Gateway.

  1.  From AWS console select API Gateway.

  1.  Click on “Create new API”. Add API name and Description.

  1.  On actions click “Create resource”.



  1.  Add some Name and Path.

  1.  Once the resource has been created, select it and then create a method for it.

  1.  Click on “Check button”.

  1. Select “Mock integration”. Click Save.

  1.  Once the diagram has been automatically created, select “Integration Response”.

  1.  Click on the black arrow to see the properties.

  1.  Select “Body Templates” -> “application/json”.

  1.  On the text field paste the JSON response. The mocked up service will respond. Click Save.

  1.  Select the root “/”, then click on “Actions” and “Deploy API”.

  1. The first time select “New Stage”, fill the text fields and click “Deploy”. Note: This is done only when you want to define a new stage. After defining a stage, you can start reusing it.

  1.  On left pane select “Stages”. Click on the method you want to test and copy the generated URL. Note: This is the external URL that you can use, for example, from Postman.


I hope you enjoyed this tutorial. If you have any questions, please leave a comment below. Happy Coding!

Gorilla Logic is always on the lookout for the best and brightest, be sure to check out our Careers Section.

Renato Quesada

Renato is a software engineer with a focus on Java technologies, Content Management Systems and e-commerce websites. He is passionate about learning new technologies. He loves outdoor activities, such as hiking and mountain biking, and enjoys traveling and meeting people.

Related Articles

Ready to be Unstoppable?

Partner with Gorilla Logic, and you can be.