Build A Serverless App With Aws Lambda Hands On

Create a chat web app using Amazon Web Services - Lambda, DynamoDB, API Gateway, S3, Cognito, CloudFront, and more.

Last updated 2022-01-10 | 4.4

- Build a chat application entirely with AWS services
- and no stand-alone servers at all
- Architect and design serverless applications
- Serve static resources to browsers using AWS's S3 (Simple Storage Service)

What you'll learn

Build a chat application entirely with AWS services
and no stand-alone servers at all
Architect and design serverless applications
Serve static resources to browsers using AWS's S3 (Simple Storage Service)
Use Javascript to dynamically modify web pages
Manage permissions and access policies using IAM (Identity and Access Management)
Manipulate and vend data in the cloud using AWS Lambda
Use CORS to manage client-side security in serverless apps
Store and retrieve data with DynamoDB
Model API's and create SDK's with API Gateway
Create a user login system with Cognito
Speed up your web app with a CloudFront CDN

* Requirements

* You'll need a desktop PC with Internet access
* Basic familiarity with HTML
* Javascript
* and AJAX will be helpful

Description

  • Build a chat application entirely with AWS services, and no stand-alone servers at all
  • Architect and design serverless applications
  • Serve static resources to browsers using AWS's S3 (Simple Storage Service)
  • Use Javascript to dynamically modify web pages
  • Manage permissions and access policies using IAM (Identity and Access Management)
  • Manipulate and vend data in the cloud using AWS Lambda
  • Use CORS to manage client-side security in serverless apps
  • Store and retrieve data with DynamoDB
  • Model API's and create SDK's with API Gateway
  • Create a user login system with Cognito
  • Speed up your web app with a CloudFront CDN

Course content

8 sections • 59 lectures

Udemy 101: Getting the Most From This Course Preview 02:10

Introduction Preview 17:40

Course overview and demo of the chat application

Setup the website Preview 11:57

Create an AWS account, an S3 bucket, upload a website, and view it in your browser

S3 Overview Preview 10:06

Buckets, paths, and static website hosting

Walkthrough of demo site Preview 06:13

We'll review all of the static HTML, CSS, and Javascript that make up our chat application so far.

Adding static data to the website Preview 05:17

For now, we'll upload some static chat data into S3 in JSON format so we have something to display.

JavaScript Syntax Basics Preview 07:44

This course uses Javascript, so let's do a quick crash course on the basics of the language.

JavaScript Parallelism Preview 05:30

How does Javascript execute in parallel to speed up your website, without dealing with all the nastiness of multi-threading and concurrency?

Accessing static data from javascript Preview 11:44

Let's dynamically modify our chat pages to include the static chat data we're vending from S3.

Exercise 1 solutions Preview 05:11

We'll walk through the previous lecture's challenge of adding a new message and a new conversation to our chats.

Lambda functions overview Preview 06:12

Learn how Lambda allows you to execute snippets of code without running a dedicated server.

Introduction to IAM and policies Preview 04:24

Identity and Access Management lets you secure your services and the services they have access to.

Creating a policy for the Lambda function Preview 05:56

Let's give our Lambda function the permissions it needs to read our data from S3.

Code walkthrough of the first Lambda function Preview 08:58

Let's dissect our first Lambda function, and how it works.

Running the lambda function with test data Preview 04:54

Learn how to create a test case for our Lambda function, and run it from within the AWS console.

Lambda triggers Preview 04:06

Triggers are what cause your Lambda function to be executed. Let's cover the various ways in which that can work.

Adding an API Gateway trigger to the function Preview 04:23

Let's set up the API Gateway in Proxy mode to trigger our Lambda function when an API is called from our client.

Understand and Setup CORS Preview 07:25

Learn how Cross-Origin Resource Sharing (CORS) gets around browser security to allow you to call web services from your page.

Calling the API from the website Preview 06:07

Let's modify our client-side code to hit the API Gateway and Lambda, instead of S3 directly.

CORS Activity Solution Preview 02:35

We'll walk through the previous lecture's challenge to break CORS support intentionally and see what happens, and to lock down our API to only be accessible to your S3 bucket.

Retrieving a conversation with the API Preview 06:55

Let's modify our app to retrieve entire conversations using the API Gateway.

Failure test activity solution Preview 03:13

We'll walk through our solution to the previous lecture's challenge of writing test cases for failure modes.

DynamoDB overview Preview 09:29

Let's cover DynamoDB from a high level, and learn how it might help us store our chat data more efficiently.

DynamoDB vs. S3 Preview 02:57

Why use DynamoDB instead of S3? There are pros and cons to each, but DynamoDB is the clear winner for us.

Create DynamoDB tables Preview 04:18

Create the tables we need for chat conversations and messages in DynamoDB

Create some sample data in DynamoDB Preview 06:19

Populate our DynamoDB tables with some sample chats for us to test with.

Update Lambda policy to access DynamoDB tables Preview 05:18

Grant our Lambda function the necessary permissions via IAM to access our DynamoDB tables instead of S3.

Read a conversation from Dynamo DB Preview 12:39

Modify and test our application to read chat conversations from DynamoDB instead of S3.

Read conversation list from DynamoDB Preview 12:16

Modify and test our application to read the conversation list from DynamoDB instead of S3.

Write new messages to DynamoDB Preview 14:53

Modify our chat application to allow users to enter new chat messages and store them in DynamoDB where others can see them!

Exercise Solution Preview 06:15

We'll walk through our solution to the challenge of handling invalid HTTP methods, and removing the now unnecessary access to S3 from our Lambda functions.

Overview of why having only one Lambda function can create problems Preview 05:44

Why go through the trouble of breaking up our monolithic Lambda function? Let's explain.

API Gateway overview - Resources and Methods Preview 09:52

What are resources and methods in the API Gateway, and how are they used?

API Gateway overview - Models Preview 03:48

What models are in the API Gateway, and how to use them.

API Gateway overview - Request Flow Preview 06:10

Dissecting the request flow diagram in the API Gateway.

Create API structure in API Gateway Preview 09:44

Let's go hands on and define our API for our chat application in the API Gateway, not in proxy mode.

Lambda functions for reading and writing messages Preview 13:02

Let's split up our Lambda function into individual ones for reading and writing messages.

API Gateway stages Preview 03:25

We'll cover stages in the API Gateway and how they are used.

Exporting a JavaScript client and Swagger Preview 13:07

With a well defined API in the API Gateway, you can automatically generate client code for Javascript, and for pretty much any other client using the Swagger definition it creates for you.

Remove hard-coded user names from Lambda Preview 06:46

We'll tackle the previous lecture's challenge of removing the hardcoded "Student" user name from our Lambda functions, and providing it as an event parameter instead.

Cognito overview Preview 07:36

Let's cover the various components of Cognito, which we'll use for user account management.

Create a user pool Preview 09:46

Let's walk through Cognito in the console, and set up the user pool for our chat application.

List Users in the API Preview 09:33

Next we need to wire things up for listing users through Lambda with an associated IAM policy and role, and through the API Gateway.

List Users on the site Preview 11:00

Let's add the front-end code for listing users - and dive into how to debug things when things don't work.

Create a new conversation Preview 12:58

Let's wire up the API and front end for creating a new conversation.

Create sign up page Preview 10:53

Let's create a working sign up page so new users can create accounts.

Create verification page Preview 04:56

Now we need to wire up a page so users can enter the authentication code they received via email, or request it to be re-sent.

Add login and logout Preview 05:49

Now that we can sign in and confirm users, let's actually sign them in and tie their identity into the rest of the app.

Add a Cognito authorizer to the API Gateway Preview 08:37

We need to reconfigure the API Gateway to use an Authorizer, and modify our input mappings to use the new authenticated user.

Pass user token to the API Preview 04:34

We have sign in and authorization on the API, and now we just need to link the two together! 

Mapping unauthorized responses to HTTP status codes Preview 08:24

In the last lecture, we challenged you to fix the problem of starting chats with yourself, and to ensure you can't see chats that you're not involved in. Let's look at our solution.

Lambda Versioning Preview 14:21

You don't want your changes to "go live" immediately. Lambda versioning ensures a known good version of what your code is what's live. We'll also use Canary to divide traffic between different deployments, create and use a test stage and promote it to production, and use version aliases to simplify the configuration of Lambda.

Using stage variables Preview 06:25

Let's see how Stage Variables can let us maintain separate databases, or resources in general, between different stages so they don't pollute each other.

CloudFront overview Preview 04:17

Let's talk about how CloudFront, AWS's content delivery network, works and why it's important.

Setting up a CloudFront CDN Preview 08:35

Let's walk through setting up CloudFront to accelerate the delivery of our static resources in S3.

Monitoring Preview 07:45

We'll tour the various monitoring available in AWS for our application, and practice setting up an alarm.

Custom domains Preview 05:32

Finally, let's walk through how you would go about associating your own custom domain name with this application. We'll also show you how to associate a custom domain name with your API layer, if that's something you want to expose more widely.

More to Explore... Preview 09:48

There's so much more learn about AWS! Here are some pointers for continuing your exploration.

Bonus Lecture: More courses to explore! Preview 00:43