Build a Basic Web Application

TUTORIAL

In this module, you will deploy your serverless function using Amazon API Gateway

Overview

In this module, we will use Amazon API Gateway to create a RESTful API that will allow us to make calls to our Lambda function from a web client (typically refers to a user's web browser). API Gateway will act as a middle layer between the HTML client we created in module one and the serverless backend we created in module two.

What you will accomplish

In this module, you will:

  • Create a new API using API Gateway
  • Define HTTP methods on your API
  • Trigger a Lambda function from an API
  • Enable cross-origin resource sharing (CORS) on an API so you can consume resources from a different origin (domain)
  • Test an API created with API Gateway from the AWS Management Console

Key concepts

RESTful API — REST stands for "Representational State Transfer" and is an architectural pattern for creating web services. API stands for "application programming interface." Thus, a RESTful API is one that implements the REST architectural pattern.

HTTP request methods — HTTP methods are designed to enable communications between clients and servers. Methods, like GET or PUT defined by the HTTP protocol, are used to indicate what action to take on a resource.

CORS — The CORS browser security feature uses HTTP headers to tell a browser to allow a given web application running at one origin (domain) to access selected resources from a server at a different origin.

Edge optimized — A resource that uses AWS global infrastructure to better serve geographically diverse clients.

 Time to complete

5 minutes

 Services used

Implementation

Application architecture

Module three is now complete. Time to review our architecture:

Architecture diagram showing services hosted in AWS Cloud, with connections shown from external users to interconnected AWS services.

We added API Gateway and connected it to our existing Lambda function. Now, we can trigger our function with an API call. We are still missing the ability to generate this call from our web client. We will add our data table first in module four and connect everything together in module five.

Was this page helpful?

Create Data Table