Amazon Cloudfront to AWS Lambda URLs with IAM Auth

Amazon CloudFront → Lambda@Edge → AWS Lambda Function URLs

Configure Amazon CloudFront to point to an AWS Lambda function via a Lambda URL with IAM authentication

An Amazon CloudFront distribution is created that forwards requests to the domain name of the deployed AWS Lambda function URL. Amazon CloudFront also caches responses from the Lambda function.
The Lambda URL is protected by IAM authentication via CloudFront and Lambda@Edge.
Amazon CloudFront also allows for custom domain names, Lambda@Edge to authenticate with Cognito, as well as AWS Web Application Firewall (WAF) and AWS Shield Advanced to protect your endpoint from attacks

< 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/cloudfront-lambda-url-cdk-ts

Deploy

cdk deploy


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

Delete the stack: cdk destroy.

Created by:

Samuel Durand

Samuel Durand

Senior AWS and JVM developper at PCG

Follow on LinkedIn