Samples and snippets of application components constructed using the Serverless Framework and Amazon Web Services (AWS).
All samples are authored in JavaScript for the Node.js AWS Lambda runtime.
This is a LEANSTACKS solution.
Each sub-directory contains a sample project illustrating a specific serverless feature or group of features. Some samples build upon concepts from other samples.
If you are new to serverless software engineering or simply looking for a table of contents, the list below is a general guideline for exploring the samples in this repository in a meaningful order.
A "Hello World" REST API demonstrating how to handle events from the API Gateway in AWS Lambda using Express and the Serverless HTTP plugin.
This sample serverless application is a basic example of how to implement REST services using Express. Data for the REST resource is persisted in DynamoDB.
This sample application is the introductory example for using DynamoDB. This project contains other DynamoDB samples which build upon this one.
This sample serverless application is a basic example of how to implement REST services using Express. Data for the REST resource is persisted in DynamoDB. The DynamoDB table is configured in on-demand capacity mode rather than fixed capacity units.
This sample application builds upon the introductory example for using DynamoDB.
This sample serverless application builds upon the basic REST API sample. It is a simple example of how to implement CRUD (Create, Read, Update, and Delete) REST services for a REST resource using NodeJS leveraging the Express framework. Data for the REST resource is persisted in DynamoDB.
Rather than deploying a single API endpoint with a single Lambda function, this project configures individual endpoints for each API endpoint.
This sample serverless application illustrates how to implement REST services for a single resource using NodeJS leveraging the Express framework. Data for the REST resource is persisted in DynamoDB.
This sample application employs the serverless-offline
and serverless-dynamodb-local
libraries to facilitate rapid local machine development and testing, alleviating the need for frequent AWS deployments during the development process.
This sample serverless application illustrates how to implement REST services with a more modular code structure. Many of the samples in this project illustrate a particular Serverless concept and all of the logic is contained within the function handler method. While this serves to illustrate the concept of the example, it is not meant to illustrate best practices when authoring Serverless applications.
This sample demonstrates how to provision custom domain names in Amazon API Gateway using the Serverless Domain Manager plugin.
This sample illustrates how to implement multiple REST services for different resources. Each service is developed and managed independently; however, they share a custom domain.
This sample demonstrates how to configure, author, and execute unit tests for a serverless application component using the Jest testing framework.
This sample serverless application illustrates how to implement REST services whose functions are passed environment variables.
This sample builds upon the rest-environment
sample by sourcing the environment variables from AWS Systems Manager Parameter Store, a.k.a. SSM.
This sample serverless application is a basic example of how to implement a Lambda Authorizer, formerly called a Custom Authorizer, for a REST API.
This sample application is the introductory example for using Lambda Authorizers. This project contains other Lambda Authorizer sample applications which build upon this one.
This sample serverless application is an example of how to implement a Lambda Authorizer, formerly called a Custom Authorizer, with JSON Web Tokens (JWT) for a REST API.
This sample serverless application is a basic example of how to implement a Cognito Authorizer which authenticates requests to a REST API with a Cognito User Pool.
This sample serverless application is an example of how to implement a shared API Gateway REST API.
Normally, each serverless specification provisions a dedicated API Gateway REST API when deployed. However, by using outputs from an api
componnet in another service
serverless specification, the service REST API endpoints are created within the API Gateway REST API provisioned by the api
component.
This sample application builds upon the shared-api
sample adding the use of Amazon API Gateway Custom Domain Names. Not only do multiple serverless projects share the same API Gateway, but that API Gateway is accessible by a custom domain name.
This sample serverless application illustrates how to implement a simple Step Functions State Machine using Serverless Framework plugins. This project creates a simple state machine which is invoked via an API Gateway event.
This sample serverless application illustrates how to implement a simple Step Functions State Machine using Serverless Framework plugins and poll for the result of the state machine execution.
Step functions state machine executions are asynchronous. This sample project demonstrates how to invoke a step function state machine programmatically and how to poll the execution history events to determine when execution has completed and extract the resulting output.
While it is not typical to invoke a Step Functions State Machine synchronously, this sample illustrates several useful AWS SDK calls for assessing the status of a State Machine invocation.
LEANSTACKS
LEANSTACKS Serverless Samples
Serverless Framework
Serverless Blog
Serverless Docs for AWS