aws-samples / serverless-patterns

Serverless patterns. Learn more at the website: https://serverlessland.com/patterns.
https://serverlessland.com
Other
1.48k stars 863 forks source link

New serverless pattern - apigw-http-api-cognito-lambda-cdk #2201

Closed philippewanner closed 1 week ago

philippewanner commented 2 months ago

Description (mid-length e.g. "Create a Lambda function that sends events to EventBridge.")

This pattern creates an Amazon API Gateway HTTP API with JWTAuthorizer and Cognito as user management. It integrates with one public Lambda and one protected Lambda.

Language: (optional e.g. "Python", if you have a Lambda function in your example)

Node.js

Framework (currently we support SAM or CDK)

CDK

Services from/to (e.g. "Lambda to EventBridge)

Amazon API Gateway to public Lambda Amazon API Gateway to protected Lambda Amazon API Gateway to AWS Cognito

Description (this must include a throughout explanation of the pattern together with details of IAM permissioning)

This pattern creates an Amazon API Gateway API HTTP API and two endpoints. The first endpoint is unprotected (no authentication/authorization) and integrate with a public Lambda function. The second endpoint is protected by a JWTAuthorizer that use Cognito as IDP and it integrates with a private Lambda function.

Deployment commands

cdk deploy

GitHub PR for template:

https://github.com/aws-samples/serverless-patterns/pull/2200

Payload example (e.g. Lambda event payload from source service).

N/A

Additional resources (optional: link and anchor text, up to 5 resources)

Working with the AWS CDK in TypeScript Working with HTTP APIs Building Lambda functions with TypeScript

Author bio

Name: Philippe Wanner Photo URL: https://www.linkedin.com/in/philippe-wanner/ LinkedIn: https://www.linkedin.com/in/philippe-wanner/ Twitter handle: n/a Description (up to 255 chars): Philippe is a Senior Specialist Solutions Architect at Amazon Web Services based in Zurich, Switzerland. His role is to spread the migration and modernization best practices for large organisations. Follow on LinkedIn

julianwood commented 1 week ago

Thanks, merged

julianwood commented 1 week ago

Thanks, merged