Nick McHardy header image

Tags

My thoughts about AWS API Gateway working with AWS Lambda

Well it's been a little while since AWS released their API Gateway. I've been playing around with it in two modes: one for real work and the other for play work (more on that later, when it is time for the big reveal). I decided I should probably collect together some of my thoughts so far about Amazon's API Management service, also known as API Gateway.

Lambda and API Gateway work quite well as complementary services, although there are quite a number of issues that I have discovered and will discuss below.

Most of the feedback below is from a bit of a build of a bit of a secret project at the moment which tries out something slightly radical:

You could build a “server-less” application without running any EC2 or RDS instances

What does this really mean? A bunch of DynamoDB tables, Lambda functions performing basic CRUD on said tables, exposed as a REST API using API Gateway with a bit of S3 to test integration with different AWS services. The great thing is the whole thing is driven based on usage. No usage? Really quiet month? Equals cheap month. And it's not like as things get popular, the costs scale at alarming rates. AWS is already really cheap.

Onwards!

This list is longer than the good stuff, but really it's early days and I can see there is great scope for future product releases.

CORS is annoying at the best of times. To setup CORS in AWS API Gateway (refer to this doc, step #5) rather than following the guide 100%, point the OPTIONS method to a dummy Node.js Lambda function that does nothing, for example:

UPDATE: This no longer seems to be required because there is a new option called “Mock Integration”. See this link for more info.

So there you have it. That's almost all the things I have experienced so far with Amazon's API Gateway. There's probably a few more points here and there but I really wanted to focus on the combination of AWS Lambda and AWS Gateway as they are really complementary products. That's complementary as in work well together, not complimentary freebies when you arrive in a restaurant.