If a cloud giant like Amazon launches an API gateway, this will definitely affect the industry. So I just had to try the Amazon API Gateway, and get a feeling for what it has to offer, even if it is just for a small getting-started project for now.

And it is pretty straightforward to get started. On the web-interface I defined an API, a resource and a GET method. The methods are then connected to a backend system. There are basically 3 options for connecting backend systems:

  • Option one is for existing services: if the backend system follows the REST style, you can simply forward the request to the existing REST service.
  • Option two is for creating a new backend system on AWS EC2. It requires setting up the VM etc. It might be worth it if there is lots of traffic and complicated business logic in the backend. But for now, I skipped over this option.
  • Option three is for creating a new, but more lightweight backend system. It uses AWS Lambda functions.There is no need to setup any VMs, just a bit of configuration on the web site and writing some code. Currently, Lambda functions can be written in Java or Nodejs.

For my trial project I selected the Lambda function using Java. Lambda functions are basically Java methods, which need to be completely stateless. It was really simple to set up such a new Lambda function, deploy it and connect it to the API method on the API Gateway.

On the AWS API Gateway there is a graphical representation of the API showing the request/response flow from client over API gateway to backend and back to the client again. On this overview you can define backend credentials and transformation rules. The transformations adapt the client request to the request being sent to the backend, and also for adapting the  backend response the response sent to the client. Amazon uses the velocity template engine for transformations. It is even possible to test the transformation and the connection right from this graphical representation, without the need to deploy the API.

amazon_api_gateway_screenshot

What is lacking from my perspective is the missing support for OAuth. The Amazon API Gateway does not offer a standard OAuth Provider. Instead, so they claim, you can forward OAuth tokens to your backend and handle it there. This is not satisfactory from my perspective. An alternative solution is the use of AWS Cognito, the proprietary authorization/authentication solution of Amazon.

I have just scratched the surface of the functionality offered by the Amazon API Gateway, there are a lot more advanced functions available, which I will report on in the future. If you are interested in an API Gateway in the cloud, this is definitely worth a thorough evaluation.

A first glimpse of the new Amazon API Gateway

Matthias Biehl

As API strategist, Matthias helps clients discover their opportunities for innovation with APIs & ecosystems and turn them into actionable digital strategies. Based on his experience in leading large-scale API initiatives in both business and technology roles, he shares best practices and provides both strategic and practical guidance. He has stayed a techie at heart and at some point, got a Ph.D. Matthias publishes a blog at api-university.com, is the author of several books on APIs, and regularly speaks at technology conferences.