Serverless Reference Architectures with AWS Lambda

• 724 words

Building your applications with only managed components has become very popular, and AWS Lambda plays a crucial role in that. I see a tremendous interest in examples how to build such applications, and articles such as “The Serverless Start-Up - Down With Servers!” about teletext.io are read eagerly around the globe.

If you are looking for more examples there are the Lambda Serverless Reference Architectures that can serve as the blueprint for building your own serverless applications.

Mobile Backend Serverless Reference Architecture

The Mobile Backend reference architecture demonstrates how to use AWS Lambda along with other services to build a serverless backend for a mobile application. The specific example application provided in this repository enables users to upload photos and notes using Amazon Simple Storage Service (Amazon S3) and Amazon API Gateway respectively. The notes are stored in Amazon DynamoDB, and are processed asynchronously using DynamoDB streams and a Lambda function to add them to an Amazon CloudSearch domain. In addition to the source code for the Lambda functions, this repository also contains a prototype iOS application that provides examples for how to use the AWS Mobile SDK for iOS to interface with the backend resources defined in the architecture.

Real-time File Processing Serverless Reference Architecture

The Real-time File Processing reference architecture is a general-purpose, event-driven, parallel data processing architecture that uses AWS Lambda. This architecture is ideal for workloads that need more than one data derivative of an object. This simple architecture is described in the “Fanout S3 Event Notifications to Multiple Endpoints” blog post on the AWS Compute Blog. This sample application demonstrates a Markdown conversion application where Lambda is used to convert Markdown files to HTML and plain text.

Web Applications Serverless Reference Architecture

By combining AWS Lambda with other AWS services, developers can build powerful web applications that automatically scale up and down and run in a highly available configuration across multiple data centers—with zero administrative effort required for scalability, backups, or multi–data center redundancy.

This example looks at using AWS Lambda and Amazon API Gateway to build a dynamic voting application, which receives votes via SMS, aggregates the totals into Amazon DynamoDB, and uses Amazon Simple Storage Service (Amazon S3)to display the results in real time.

The architecture can be created with an AWS CloudFormation template.

The template does the following:

  • Creates an S3 bucket named to hold your web app.
  • Creates a DynamoDB table named VoteApp to store votes
  • Creates a DynamoDB table named VoteAppAggregates to aggregate vote totals
  • Creates a Lambda function that allows your application to receive votes
  • Creates a Lambda function that allows your application to aggregate votes
  • Creates an AWS Identity and Access Management (IAM) role and policy to allow Lambda functions to write to Amazon CloudWatch Logs and write and query the DynamoDB tables

IoT Backend Serverless Reference Architecture

The Internet of Things (IoT) Backend reference architecture demonstrates how to use AWS Lambda in conjunction with Amazon Kinesis, Amazon DynamoDB, Amazon Simple Storage Service (Amazon S3), and Amazon CloudWatch to build a serverless system for ingesting and processing sensor data. By leveraging these services, you can build cost-efficient applications that can meet the massive scale required for processing the data generated by huge deployments of connected devices.

This repository contains sample code for all the Lambda functions depicted in this diagram as well as a AWS CloudFormation template for creating the functions and related resources. There is also a simple webpage that you can run locally to publish sample events and query the data from DynamodDB.

Real-time Stream Processing Serverless Reference Architecture

You can use AWS Lambda and Amazon Kinesis to process real-time streaming data for application activity tracking, transaction order processing, click stream analysis, data cleansing, metrics generation, log filtering, indexing, social media analysis, and IoT device data telemetry and metering. The architecture can be created with an AWS CloudFormation template.

The template does the following:

  • Creates a Kinesis Stream
  • Creates a DynamoDB table named stackname-EventData
  • Creates Lambda Function 1 (stackname-DDBEventProcessor) which receives records from Kinesis and writes records to the DynamoDB table
  • Creates an IAM Role and Policy to allow the event processing Lambda function read from the Kinesis Stream and write to the DynamoDB table
  • Creates an IAM user with permission to put events in the Kinesis stream together with credentials for the user to use in an API client