Skip to content
Welcome to the LEANSTACKS Serverless Samples project. This repository contains samples and snippets of serverless code.
Branch: master
Clone or download
Latest commit 3f338d3 May 13, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
custom-domain-multi-svc Initial custom domain multi-service sample. Mar 7, 2019
custom-domain Update custom domain sample with serverless-domain-manager plugin. Mar 7, 2019
rest-cognito-authorizer README May 13, 2019
rest-dynamodb-local Initial REST local sample. Mar 6, 2019
rest-dynamodb-modular Initial modular REST service sample. Mar 19, 2019
rest-dynamodb-multi-fn README Mar 19, 2019
rest-dynamodb-ondemand Initial DynamoDB On-Demaind sample Mar 21, 2019
rest-dynamodb README Mar 19, 2019
rest-environment-ssm Initial Environment Variables from AWS Systems Manager Parameter Stor… Mar 22, 2019
rest-environment Initial service with environment variables sample. Mar 16, 2019
rest-hello Update hello world sample service name. Mar 5, 2019
rest-lambda-authorizer-jwt Initial Lambda Authorizer with JWT sample. Mar 22, 2019
rest-lambda-authorizer Initial REST API with Simple Lambda Authorizer sample. Mar 19, 2019
shared-api-custom-domain Initial REST Services with Shared API and Custom Domain Mar 21, 2019
shared-api Initial REST Services with Shared API Mar 20, 2019
step-functions-api-sync nitial Step Functions Execute and Poll sample. Apr 4, 2019
step-functions Initial Step Functions sample. Mar 27, 2019
test-jest Initial unit tests with Jest sample. Mar 8, 2019
.gitignore Initial Cognito Authorizer. May 9, 2019
LICENSE Initial commit Mar 5, 2019
README.md Initial Cognito Authorizer. May 9, 2019

README.md

Serverless Samples

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 8.10 AWS Lambda runtime.

Acknowledgements

This is a LEANSTACKS solution.

What's Inside

Each sub-directory contains a sample project illustrating a specific serverless feature or group of features. Some samples build upon concepts from other projects.

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.

rest-hello

A "Hello World" REST API demonstrating how to handle events from the API Gateway in AWS Lambda using Express and the Serverless HTTP plugin.

rest-dynamodb

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 sample projects which build upon this one.

rest-dynamodb-ondemand

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.

rest-dynamodb-multi-fn

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.

rest-dynamodb-local

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.

rest-dynamodb-modular

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.

custom-domain

This sample demonstrates how to provision custom domain names in Amazon API Gateway using the Serverless Domain Manager plugin.

custom-domain-multi-svc

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.

test-jest

This sample demonstrates how to configure, code, and execute unit tests for a serverless application component using the Jest testing framework.

rest-environment

This sample serverless application illustrates how to implement REST services whose functions are passed environment variables.

rest-environment-ssm

This sample builds upon the rest-environment sample by sourcing the environment variables from AWS Systems Manager Parameter Store, a.k.a. SSM.

rest-lambda-authorizer

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.

rest-lambda-authorizer-jwt

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.

rest-cognito-authorizer

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.

shared-api

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 the api project in the service serverless specification, the service REST API endpoints are created within the API Gateway REST API provisioned in the api project.

shared-api-custom-domain

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.

step-functions

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.

step-functions-api-sync

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 invokation.

See Also

LEANSTACKS
LEANSTACKS Serverless Samples
Serverless Framework
Serverless Blog
Serverless Docs for AWS

You can’t perform that action at this time.