Going serverless - introduction to AWS Lambda

This repo contains a series of introductory examples for AWS Lambda. The code examples have an increasing level of complexity, and will progressively disclore different features of the AWS Lambda ecosystem.

What are you getting

The repo has the following folders:

  • /docs - contains the slide deck that that provides the content in which the various examples are presented
  • /01-basic-example - the "hello world" of AWS Lambda. Intended as an accessible introduction to the AWS console.
  • /02-simple-aws-http-api - an example that uses the API Gateway to expose a Lambda function to the Internet.
  • /03-dependencies - introduces AWS SAM, and how to add dependencies to the code.
  • /04-powertools - introduces AWS Lambda Powertools and focuses on logs and metrics.

Requirements

In order to run the examples you will need the following:

Useful commands for SAM based examples

Example commands to do the most common tasks with the AWS SAM CLI from the root directory of each example:

  • Running locally:
sam local start-api
  • Running unit tests:
python -m pytest tests/unit -v
  • Running integration tests:
# You can find the stack name for each example in `samconfig.toml`
AWS_SAM_STACK_NAME=<REPLACE WITH STACK NAME> python -m pytest tests/integration -v
  • Deploy to AWS:
sam build && sam deploy