DavidWells / serverless-workshop

⚡️ Open source serverless workshop. Ready to deploy serverless examples on AWS
185 stars 52 forks source link

Serverless Workshop

This repo will teach you the core concepts of serverless and walk through a variety of ready to deploy serverless architectures

If you'd like the serverless training for your team, get in touch with me.

Table of Contents

Using this repo

After following the prerequisite setup steps, work from the lessons folders.

If you get stuck or want to look ahead checkout the lessons-code-complete directory for the completed code.

Repo directory structure:

Workshop Lessons

Core Concepts

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

Events

Lesson Final Code
Dynamodb Streams
Using DynamoDB streams
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. Verify you have git on your machine

    Most machines come pre-loaded with git. 🎉

    To verify you have git, open up your terminal and run:

    which git

    This should return a path of where git is installed. If the command returns git not found, we will need to install git on your machine.

  3. Setup a AWS account

    If you don't already have an AWS account, let's get one setup.

    Click here to setup a free AWS account

    It's recommended to not use pre-existing AWS account running production code.

    Make sure you add valid billing information and verify your account.

  4. Install serverless CLI

    Open up your terminal and run:

    npm install serverless -g
  5. Connect the serverless CLI with your AWS account credentials

    See the docs or watch the video

  6. Verify the Serverless CLI works on your machine

    Open up your terminal and run:

    serverless --help

    This should return the list of commands from the CLI tool.

    Now let's verify your AWS account is correctly configured. Open up your terminal and run the following commands:

    # create a test project
    serverless create --template aws-nodejs --path my-test-service
    # move into the `my-test-service` directory
    cd my-test-service
    # deploy the test service to verify AWS credentials
    serverless deploy

    This should deploy the test service into AWS. If you encounter errors, please ping me and we can get them sorted out.

Bonus setup:

Troubleshooting & FAQ