Multi-tenant Serverless API

API Gateway REST API → AWS Lambda authorizer → AWS Lambda functions → Amazon DynamoDB

Create a multi-tenant serverless API using Amazon API Gateway, AWS Lambda, and Amazon DynamoDB with tenant based authorization .

In this project, requests are authorized using API keys mapped to tenants in DynamoDB. Access to data is restricted using dynamic IAM policies based on the tenant ID.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/serverless-multi-tenant-api

Deploy

npm installsam buildsam deploy


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

Delete the stack: sam delete.

Created by:

Michael Ohde

Michael Ohde

Michael Ohde is a Senior Solutions Architect from Long Beach, CA. As a Product Acceleration Solution Architect at Amazon Web Services (AWS), he currently assists Independent Software Vendor (ISVs) in the GovTech and EdTech sectors, by building modern applications using practices like serverless, DevOps, and AI/ML.

Follow on LinkedIn

Swapnil Singh

Swapnil Singh

Swapnil Singh is a Solutions Architect at Amazon Web Services (AWS).

Follow on LinkedIn