Serverless Workshop

Welcome to the workshop. This repo will guide us through our serverless journey.

Using this repo

Work from the lessons folders.

If you need help, look in the lessons-code-complete directory for the completed code.

|- lessons (work from these)
|- lessons-code-complete (answers if you need to see them)

Table of Contents

Workshop Lessons

Lesson Final Code
1 Http Hello World
Deploying Your First Endpoint
Complete Code
2 Http Dynamic Content
Dynamic Content in Functions
Complete Code
3 Http Post With Cors
Deploying an http POST endpoint with CORS support
Complete Code
4 Using Env Vars
Using environment variables
Complete Code
5 Using Serverless Variable Syntax
Using Serverless variable syntax
Complete Code
6 Using Addition Resources
Defining additional resources
Complete Code
7 Using Serverless Plugins
Extending Serverless Functionality with plugins
Complete Code
8 Using Multiple Stages
Deploying to Multiple Stages
Complete Code
Dynamodb Streams
Defining additional resources
Complete Code
Kinesis Basic
Simple Kinesis Example
Complete Code
Kinesis
Using Kinesis as an Event Source
Complete Code
S3
Triggering Lambda functions from s3 events
Complete Code
Schedule
Triggering functions via cron schedules
Complete Code
Sns
Using AWS SNS as event source
Complete Code
Sns Advanced
Using External SNS Topics Example
Complete Code
Sns Basic
Basic SNS Example
Complete Code
Step Functions
Using AWS Step Functions
Complete Code

Helpful Tools

Prerequisites & Setup Steps

  1. **Install the latest LTS version of **Node. How to install Node.
  2. Install git version control.
  3. **Setup a AWS account (if you don't already have one). **You can setup a free account here: setup free AWS account. It's recommended to not use pre-existing AWS account running production code.
  4. **Install serverless CLI **by running npm install serverless -g on the command line. 
  5. Run serverless --help in your terminal to validate the Serverless CLI works on your machine.
  6. Then connect the serverless framework with your AWS credentialsSee the docs or watch the video

Troubleshooting & FAQ

  • Y A M L Exception? check your yaml indentation syntax. yaml validator | yaml validator two

  • Unable to import module 'handler': Error at Function.Module._resolveFilename (module.js:469:15)

    This error means lambda can't find your included node_modules. Make sure you npm install in your project and install all your dependancies locally before running sls deploy

  • Unable to delete bucket error. Your s3 bucket in question might have files in it. You will need to head into AWS cloudformation in the console and manually delete the stack.

  • Stack [xyz] cannot be deleted while in status UPDATE_ROLLBACK_COMPLETE_CLEANUP_IN_PROGRESS This happens when cloudformation gets stuck in a weird state. You might need to log into the AWS console, head into cloudformation and delete the stack from the UI