WebSocket API Amazon Cognito authentication using AWS Lambda authorizer

API Gateway Websocket API → AWS Lambda → AWS Lambda → DynamoDB → Cognito

This pattern shows how to integrate Cognito authentication with Amazon API Gateway WebSocket API.

This pattern shows how to integrate Cognito authentication with Amazon API Gateway WebSocket API.
It includes the Lambda implementations for Lambda authorizer, Lambda functions for $connect, $disconnect and custom route, and AWS Serverless Application Model (SAM) code to deploy backend infrastructure.

< 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/apigw-websocket-api-lambda-authorizer

Deploy

sam buildsam deploy --guided


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

Delete the template: sam delete.

Created by:

Ankush Jain

Ankush Jain

Application Development Consultant at AWS Professional Services.

Follow on LinkedIn