O'Reilly logo
live online training icon Live Online training

Creating serverless APIs with AWS Lambda and API Gateway

Save time and money by serving API calls with on-demand computing

Bill Boulden

In many projects, it’s natural to put the responsibility of responding to API calls, with their highly variable computing needs, on the same infrastructure that serves web pages and assets, but you can save both time and money by serving API calls with on-demand computing.

Join Bill Boulden to explore a serverless architecture that removes load from web servers and keeps you from paying for an instant of wasted idle time—all while scaling flawlessly to handle any volume. Over three hours, using a combination of lectures and hands-on exercises, Bill highlights the benefits of serverless architectures compared to traditional API server fleets and walks you through creating a functioning serverless API—using Amazon API Gateway to route calls to AWS Lambda for on-demand, pay-by-the-millisecond execution—that coexists alongside conventionally served web pages.

What you'll learn-and how you can apply it

By the end of this live online course, you’ll understand:

  • On-demand computing basic concepts and benefits
  • How API Gateway and AWS Lambda interact and how to use them together
  • What extra context and objects are used to interact with the AWS Lambda environment
  • The advantages of serverless architectures compared to traditional API server fleets, autoscaled or not
  • When serverless APIs make sense (and when they don't)

And you’ll be able to:

  • Upload and update functions in AWS Lambda
  • Interpret RESTful API requests and serve responses from AWS Lambda
  • Create and manage an API gateway
  • Configure an API gateway to answer HTTP requests

This training course is for you because...

  • You’re an experienced Node.js or Python developer who wants to start serving requests as a service.
  • You’re an infrastructure or API architect interested in saving money on server fleets.
  • You expect your application to scale rapidly in the near future, and you want your API to stay available regardless of load.

Prerequisites

  • Intermediate proficiency or higher in Node.js or Python (The course will be taught in Node.js, but course materials will be provided, although not taught, in Python.)
  • A basic understanding of HTML5 and JavaScript in the DOM (e.g., how to manipulate a simple form on a web page), domain names, and relational databases
  • Familiarity with API concepts such as statelessness and RESTfulness

Required materials and setup:

  • A machine with a bash or POSIX-like command line and the AWS Command Line Interface tools installed
  • A paid AWS account (Costs will be miniscule—in the single digit cents—but many AWS Lambda and API Gateway features are not available on the free tier.)

Recommended preparation:

Getting Started with Node.js (video)

About your instructor

  • Bill Boulden has been developing software since the age of 6. In 2014, he left his role as API Architect at Delaware North Companies to become the lead engineer and eventual Chief Technology Officer of ClearView Social. In his time at ClearView, he has migrated a vm-driven infrastructure to an autoscaling application fleet with serverless components. Running serverless applications in production has given him a unique perspective on architecture and application delivery for modern companies. In his spare time, he’s a pink-haired house music DJ by the name of Spruke who enjoys EDM and generative ambient music.

Schedule

The timeframes are only estimates and may vary according to how the class is progressing

Introduction (10 minutes) - Lecture: Defining key concepts, including API, RESTFulness, and statelessness

On-demand computing as a service (25 minutes)

  • Lecture: Overview of on-demand computing as a service; how it helps create a serverless API; the bare minimum knowledge of AWS Lambda needed to get a "Hello, World" request/response running
  • Hands-on exercises: Walk through a “Hello, World” example; use the UI to upload a simple lambda function

Amazon API Gateway (25 minutes)

  • Lecture: Overview of API Gateway; how it helps create a serverless API; the bare minimum knowledge of API Gateway needed to make the simplest possible API gateway
  • Hands-on exercises: Walk through a “Hello, World” example; use the UI to connect the "Hello, World" to an API gateway

Break (10 minutes)

  • Implementing an API function in practice (30 minutes)
  • Hands-on exercises: Download a static HTML file representing a client-side rendered page you'll be hooking up to a serverless API; describe the needs of the API function; write the API function; hook up the API function to an API gateway
  • Q&A

Business implications of serverless APIs (20 minutes)

  • Lecture: The API jobs best and least suited for serverless computing; how to find opportunities in your day-to-day work to use these techniques most effectively
  • Q&A

Break (10 minutes)

Next steps for creating serverless APIs (20 minutes) - Lecture: Introduction to the Serverless Framework; putting an API gateway behind CloudFront; putting an API gateway under a Route 53 domain name; using CloudWatch to pull advanced server metrics

Wrap-up and Q&A (30 minutes)