AWS Lambda in Action
Event-driven serverless applications
Danilo Poccia
Foreword by James Governor
  • November 2016
  • ISBN 9781617293719
  • 384 pages
  • printed in black & white

Clear and concise...the code samples are as well structured as the writing.

From the Foreword by James Governor, RedMonk

AWS Lambda in Action is an example-driven tutorial that teaches you how to build applications that use an event-driven approach on the back end.

Table of Contents detailed table of contents

Part 1: First Steps

1. Running functions in the Cloud

1.1. Introducing AWS Lambda

1.2. Functions as your back end

1.3. A single back end for everything

1.4. Event-driven applications

1.5. Calling functions from a client

1.6. Summary

2. Your first Lambda function

2.1. Creating a new function

2.2. Writing the function

2.3. Specifying other settings

2.4. Testing the function

2.5. Executing the function through the Lambda API

2.6. Summary

2.7. Exercise

2.7.1. Solution

3. Your function as a web API

3.1. Introducing the Amazon API Gateway

3.2. Creating the API

3.3. Creating the integration

3.4. Testing the integration

3.5. Transforming the response

3.6. Using resource paths as parameters

3.7. Using the API Gateway context

3.8. Summary

3.9. Exercise

3.9.1. Solution

Part 2: Building Event-driven Applications

4. Managing security

4.1. Users, groups, and roles

4.2. Understanding policies

4.3. Policies in practice

4.4. Using policy variables

4.5. Assuming roles

4.6. Summary

4.7. Exercise

4.7.1. Solution

5. Using standalone functions

5.1. Packaging libraries and modules with your function

5.2. Subscribing functions to events

5.2.1. Creating the back-end resources

5.2.2. Packaging the function

5.2.3. Configuring permissions

5.2.4. Creating the function

5.2.5. Testing the function

5.3. Using binaries with your function

5.3.1. Preparing the environment

5.3.2. Implementing the function

5.3.3. Testing the function

5.4. Scheduling function execution

5.5. Summary

5.6. Exercise

5.6.1. Solution

6. Managing identities

6.1. Introducing Amazon Cognito Identity

6.2. External identity providers

6.3. Integrating custom authentications

6.4. Having authenticated and unauthenticated users

6.5. Using policy variables with Amazon Cognito

6.6. Summary

6.7. Exercise

6.7.1. Solution

7. Calling functions from a client

7.1. Calling functions from JavaScript

7.1.1. Creating the identity pool

7.1.2. Giving permissions to the Lambda function

7.1.3. Creating the web page

7.2. Calling functions from a Mobile app

7.2.1. Sample code for native mobile apps

7.3. Calling functions from a web browser

7.3.1. Integrating the Lambda functions with the Amazon API Gateway

7.4. Summary

7.5. Exercise

7.5.1. Solution

8. Designing an authentication service

8.1. The interaction model

8.2. The event-driven architecture

8.3. Working with Amazon Cognito

8.4. Storing user profiles

8.5. Adding more data to user profiles

8.6. Encrypting passwords

8.7. Summary

8.8. Exercise

8.8.1. Solution

9. Implementing an authentication service

9.1. Managing a centralized configuration

9.2. Automating initialization and deployment

9.3. Having shared code

9.4. Creating the home page

9.5. Signing up new users

9.6. Validating user emails

9.7. Summary

9.8. Exercise

9.8.1. Solution

10. Adding more features to the authentication service

10.1. Reporting lost passwords

10.2. Resetting passwords

10.3. Logging in users

10.4. Getting AWS credentials for authenticated users

10.5. Changing passwords

10.6. Summary

10.7. Exercise

10.7.1. Solution

11. Building a media-sharing application

11.1. The event-driven architecture

11.1.1. Simplifying the implementation

11.1.2. Consolidating some functions

11.1.3. Evolving an event-driven architecture

11.2. Defining an object namespace for Amazon S3

11.3. Designing the data model for Amazon DynamoDB

11.4. The client application

11.5. Reacting to content updates

11.6. Updating content indexes

11.7. Summary

11.8. Exercise

11.8.1. Solution

12. Why event-driven?

12.1. Overview of event-driven architectures

12.2. Starting from the front end

12.3. What about the back end?

12.4. Reactive programming

12.5. The path to microservices

12.6. Scalability of the platform

12.7. Availability and resilience

12.8. Estimating costs

12.9. Summary

12.10. Exercise

12.10.1. Solution

Part 3: From Development to Production

13. Improving development and testing

13.1. Developing locally

13.1.1. Developing locally in Node.js

13.1.2. Developing locally in Python

13.1.3. Community tools

13.2. Logging and debugging

13.3. Using function versioning

13.4. Using aliases to manage different environments

13.5. Development tools and frameworks

13.5.1. Chalice Python microframework

13.5.2. Apex serverless architecture

13.5.3. Serverless Framework

13.6. Simple serverless testing

13.7. Summary

13.8. Exercise

13.8.1. Solutions

14. Automating deployment

14.1. Storing code on Amazon S3

14.2. Event-driven serverless continuous deployment

14.3. Deploying with AWS CloudFormation

14.4. Multiregion deployments

14.5. Summary

14.6. Exercise

14.6.1. Solutions

15. Automatic infrastructure management

15.1. Reacting to alarms

15.2. Reacting to events

15.3. Processing logs in near real-time

15.4. Scheduling recurring activities

15.5. Multiregion architectures and data synchronization

15.6. Summary

15.7. Exercise

15.7.1. Solutions

Part 4: Using external services

16. Calling external services

16.1. Managing secrets and credentials

16.2. Using IFTTT Maker Channel

16.3. Sending messages to a Slack team

16.4. Automating the management of your GitHub repository

16.5. Summary

16.6. Exercise

16.6.1. Solutions

17. Receiving events from other services

17.1. Who’s calling?

17.2. The webhook pattern

17.3. Handling events from Slack

17.4. Handling events from GitHub

17.5. Handling events from Twilio

17.6. Using MongoDB as a trigger

17.7. The log monitoring pattern

17.8. Summary

17.9. Exercise

17.9.1. Solutions

About the Technology

With AWS Lambda, you write your code and upload it to the AWS cloud. AWS Lambda responds to the events triggered by your application or your users, and automatically manages the underlying computer resources for you. Back-end tasks like analyzing a new document or processing requests from a mobile app are easy to implement. Your application is divided into small functions, leading naturally to a reactive architecture and the adoption of microservices.

About the book

AWS Lambda in Action is an example-driven tutorial that teaches you how to build applications that use an event-driven approach on the back-end. Starting with an overview of AWS Lambda, the book moves on to show you common examples and patterns that you can use to call Lambda functions from a web page or a mobile app. The second part of the book puts these smaller examples together to build larger applications. By the end, you'll be ready to create applications that take advantage of the high availability, security, performance, and scalability of AWS.

What's inside

  • Create a simple API
  • Create an event-driven media-sharing application
  • Secure access to your application in the cloud
  • Use functions from different clients like web pages or mobile apps
  • Connect your application with external services

About the reader

Requires basic knowledge of JavaScript. Some examples are also provided in Python. No AWS experience is assumed.

About the author

Danilo Poccia is a technical evangelist at Amazon Web Services and a frequent speaker at public events and workshops.

combo $49.99 pBook + eBook
eBook $39.99 pdf + ePub + kindle

FREE domestic shipping on three or more pBooks

A superb guide to an important aspect of AWS.

Ben Leibert, VillageReach

Step-by-step examples and clear prose make this the go-to book for AWS Lambda!

Dan Kacenjar, Wolters Kluwer

Like Lambda itself, this book is easy to follow, concise, and very functional.

Christopher Haupt, New Relic