AWS Lambda with API Gateway

AWS Lambda with API Gateway

We have been spending a lot of time recently working on AWS Lambda solutions (primarily with Python and NodeJS languages). Lamba is a “serverless” system, meaning organisations need not maintain a barrage of EC2 instances to handle traffic. Instead, single-task Lambda functions are written. API Gateway (or another trigger) enables these to run in response to various conditions and requests.

The upshot is that there is only an operating cost when work is done. A complex API structure can be built with API Gateway, but until data comes in and is processed, there is no fee.

This is ideal for applications which start small and grow. Costs are kept low until users arrive.

We build our API Gateway solutions using CloudFormation stacks (often defined using Swagger), which means easily-creatable test environments. It also allows us to define the Lambda functions centrally. We have our own deployment system for quickly updating the plethora of Lambda functions involved with a solution. We can track the application as one entity, deploying individual updates when required. Systems such as AWS Step Functions can come into play here too.

Using Cloudformation, we can quickly pull in many other parts of AWS. For example, SQS can be used to manage data flow between lambda functions or EC2 servers. Our custom connectors allow SQS messages to trigger Lambda functions, using scheduled events and a secondary lambda function.

We have also built complete severless web applications based on Lambda, API Gateway, DynamoDB and AngularJS (hosted on S3). Authentication for these apps tends to be provided by AWS Cognito.