Skip to content

localstack-samples/lambda-sam-authorizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AWS Serverless Application Model (SAM) with LocalStack Lambda and Authorizer

Demonstrates how to use AWS SAM with LocalStack to create a Lambda function and an API Gateway with an authorizer.

Architecture

Prerequisites

Installing

Setup Serverless Application Model (SAM) and AWS SAM CLI Local on your local machine. We also recommend using NodeJS 14.x alongside a Node Version Manager to manage your NodeJS versions.

Create a file named .env-local and put your LocalStack Auth Token in it. It is ignored by gitignore.

export LOCALSTACK_AUTH_TOKEN=<your-token>>

Start LocalStack via:

localstack start -d

Deploy the application

Let us first install the local dependencies:

make install

To setup the infrastructure on LocalStack, run:

make deploy

You will be prompted to enter a name for the stack. Use the default options for the prompts and fill Y (Yes) for the confirmation prompt. The stack will be created and the output will be printed to the console.

After deploying, you can invoke the Lambda function using the following commands:

make invoke-allow
make invoke-deny
make invoke-unauthorized
make invoke-none

About

AWS Serverless Application Model (SAM) with LocalStack Lambda and Authorizer

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published