Running Serverless

Table of Contents

Copyright
About the author
Thanks to everyone who helped
Learn about updates

Introduction

1 Serverless in five minutes
The serverless pricing model
How request pricing affects deployment architecture
How request pricing affects security
How request pricing affects product decisions
Important AWS Lambda technical constraints
When to use Lambda

2 Set up tools for local development
Setting up prerequisites
Installing JavaScript tools
Installing the SAM command line tools
Configuring access credentials
Running with restricted user accounts
Using a profile

3 Create a web service
Infrastructure as code
The Lambda programming model
Deploying SAM applications
Step 1: Build
Step 2: Package
Step 3: Deploy
Inspecting a stack
Inspecting a stack from the command line

4 Development and troubleshooting
Retrieving execution logs
Retrieving logs from the command line
Searching logs
Logging incoming events
Simulating Lambda locally
Debugging functions
Validating templates
Working in a team
Setting up a deployment pipeline

5 Safe deployments
Function configurations
Versions and aliases
Gradual deployments
Adding deployment alerts

6 Handling HTTP requests
API Gateway events
Customising responses
Troubleshooting Gateway integrations
Processing request parameters
Using global settings to configure the implicit API
Creating parameterised CloudFormation stacks
Defining stack parameters
Referencing parameter values
Custom API domain names
Provide parameter values during deployment
Making stack parameters more user-friendly

7 Using external storage
Cloud storage options
Lambda access rights
Generating unique references
Using AWS resources from Lambda functions
Passing resource references to functions
Authorising access with IAM policies
Dealing with network timeouts

8 Cheaper, faster, serverless
Signing requests
Signed download URLs
Protecting S3 files

9 Handling platform events
Generating test events
Working with files
Working with asynchronous events
Avoiding circular references
Setting custom IAM policies
Handling asynchronous errors with dead letters
Conditional resources

10 Using application components
The AWS Serverless Application Repository
Lambda layers
Linking functions with layers
Invoking system utilities
Publishing to SAR

11 Managing sessions and user workflows
Moving session state out of Lambda functions
Resumable sessions
Minimise coordination
Moving static assets out of Lambda functions
Using S3 as a web server
Working with cross-origin resource sharing
Configuring S3 buckets for CORS
Configuring API Gateway for CORS
Uploading files to S3
Using custom resources to extend CloudFormation
Redeploying custom resources
Uploading files without the SAR component

12 Designing robust applications
API endpoints with path parameters
Designing with Ports and Adapters
Request processor
Infrastructure adapters
Lambda utility methods
Lambda entry code
Protecting against abuse
API throttling
Lambda throttling
Monitoring throttling

13 Deployment options
Think about jobs, not functions
One Lambda or many?
Aggregate processing data ownership
Aggregate code that needs to be consistent
Divide code around security boundaries
Divide code around CPU and memory needs
Divide tasks around timing restrictions
Sharing behaviour
Bundling shared libraries
Working with Lambda layers
Invoking one function from another
Sharing configuration

Where next?

More info

Get the book