hands-on lab

Build RESTful Microservices with AWS Lambda and API Gateway

Difficulty: Intermediate
Duration: Up to 2 hours and 15 minutes
Students: 10,532
Rating: 4.5/5
You can pause this lab for up to 1h
Get guided in a real environmentPractice with a step-by-step scenario in a real, provisioned environment.
Learn and validateUse validations to check your solutions every step of the way.
See resultsTrack your knowledge and monitor your progress.

Description

Amazon API Gateway allows you to design RESTful interfaces and connect them to your favorite backend. You can design your own resources structure, add dynamic routing parameters, and develop custom authorizations logic. Each API resource can be configured independently, while each stage can have specific cache, throttling, and logging configurations.

This approach is particularly useful when you consider that each request and response can be attached to a custom mapping template, in order to perform custom data manipulation or improve API backward compatibility.

In this Lab, you will see how to define a simple API and how to connect it to AWS Lambda. This provides a nice way to obtain a scalable backend for modern web applications or mobile apps. You will configure custom stages, protect resources with an API key, and explain how to best connect API Gateway stages with AWS Lambda versions and aliases. You will learn about AWS Lambda's basic configuration, monitoring, and versioning as you progress through the Lab.

Lab Objectives

Upon completion of this Lab, you will be able to:

  • Understand the basics of RESTful APIs
  • Implement REST APIs using Amazon API Gateway
  • Enable desirable API features in API Gateway including caching, throttling, CORS, usage plans, and API key access
  • Create serverless API backends using AWS Lambda functions
  • Implement best practices for integrating Lambda backends in API Gateway

Lab Prerequisites

You should be familiar with:

  • Serverless computing fundamentals, particularly AWS Lambda, is beneficial
  • Prior experience using or implementing REST APIs is beneficial, but not required

Updates

February 28th, 2024 - Updated the instructions and screenshots to reflect the latest UI

October 24th, 2023 - Updated the instructions and screenshots to reflect the latest UI

August 9th, 2023 - Updated the instructions and screenshots to reflect the latest UI

May 2nd, 2022 - Updated the instructions and screenshots to reflect the latest UI

April 5th, 2022 - Updated instructions for clarity

March 31st, 2021 - Updated all Amazon API Gateway screenshots

March 9th, 2021 - Updated AWS Lambda lab step to reflect latest user interface changes

January 22nd, 2021 - Updated AWS Lambda lab step to reflect latest user interface changes

July 21st, 2020 - Updated lab security policy to prevent the appearance of a DescribeVpcEndpoints error pop-up while creating the REST API

January 10th, 2019 - Added a validation lab step to check the work you perform in the Lab

September 5, 2018 - Improved Lab instructions format and clarity. Updated instructions and screenshots to match the new API Gateway interface

Environment before

Environment after

Covered topics

Lab steps

Logging In to the Amazon Web Services Console
Understanding RESTful APIs
Defining New API Gateway Resources
Creating an AWS Lambda Function Backend
Versioning and Aliasing the Lambda Function
Configuring the API Gateway Backend
Following Best Practices for Versions, Aliases, and Stages
Creating API Keys and Usage Plans
Enabling CORS on API Gateway Resources
Enabling API Gateway Caching and Throttling
Cleaning up API Resources and Lambda Functions