Mock AWS Services Using Postman Collections With Examples
02 Dec 2019
As I create each of the 50+ Postman collections for AWS services I am always striving for establishing as complete of a collection I as possibly can—this includes having examples for each API request being defined. This is something that is easier said than done, as there are many different ways in which you can setup your AWS infrastructure, and work with your infrastructure using AWS APIs, but nonetheless, I still strive for ensuring there is an example saved as part of each Postman collection. While this helps me better define each request, there are numerous benefits from having API examples, and one of the most beneficial of these is being able to generate mock APIs from the AWS Postman collections I’m publishing.
Taking a look at the Postman collection I have published for Amazon DynamoDB, I have managed to save examples for each of the API requests documented as part of the AWS reference Postman collection. This makes it so anyone can run the Postman collection within their own Postman platform account, and then generate a mock server for the Amazon DynamoDB API. Allowing developers to develop against the API without actually having to use a live AWS account, have the proper infrastructure and permissions setup, making it quicker and easier to jumpstart the development of desktop, web, and mobile applications. Allowing developers to publish their own mock servers for AWS services, and save time and money when it comes to your AWS budget.
I can envision developing AWS Postman collections that are complete with examples derived from specific AWS infrastructure deployments. Tailoring a specific setup and configuration, then making API requests to the AWS APIs needed for orchestrating against these existing infrastructure configurations, and saving the examples return from each API response. Essentially taking a snapshot of an existing AWS setup across multiple services, then making that snapshot available as a mocked set of AWS APIs that return the responses developers are needing when building specific application or integration. Using Postman to on-board developers with a specific architectural implementation, while also enabling development against the implementation via APIs without having to actually work with a live production environment, which impacts your overall project costs and AWS bill.
The notion of having mocks instances of the common AWS APIs I depend on is pretty valuable, but having mock instances as well as Postman collections for common ways that I setup infrastructure on AWS is even more interesting. This all begins to look a little like Ansible and Terraform for me, but for developers who just get API and don’t understand these newer ways to deliver and manage infrastructure. Allowing developers to organize many different AWS units of compute they execute regularly, and reuse them across many different projects. I can see these types of Postman collections used to help developers manage their AWS infrastructure, but also be used to on-board new developers to existing ways of delivering infrastructure on AWS—providing a sort of templating approach to spinning up, managing, tearing down, and managing costs on AWS.
As part of my week at re:Invent I am going to be working on different AWS API implementations using the reference Postman collections I have crafted. I am working to define Postman collections that help deploy and manage APIs on AWS. I wanted to create reference Postman collections to highlight what you can do with AWS APIs using Postman, but I wanted to quickly be able to demonstrating other more interesting ways you can use these collections. Mocking AWS services using Postman collections represents a pretty compelling use case, especially if you pre-populate it with examples that are actually relevant to how you deliver AWS infrastructure, allowing system integrators and application developers more rapidly deliver their work, without incurring AWS charges, using mocked APIs deployed from AWS Postman collections. I will keep playing around and seeing what other useful examples of how you can use Postman to streamline and automate your AWS operations.