Skip to content

added pattern - cloudfront-keyvaluestore-apigw-routing-cdk #2731

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

marcojahn
Copy link
Contributor

@marcojahn marcojahn commented May 2, 2025

Issue #, if available:
#2732

Description of changes:
This pattern demonstrates how to use Amazon CloudFront with CloudFront Functions to dynamically route traffic between multiple Amazon API Gateway endpoints. The routing decisions are based on values stored in CloudFront Key Value Store, allowing for flexible, configuration-driven request routing without redeploying your infrastructure.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@marcojahn marcojahn changed the title added pattern added pattern - cloudfront-keyvaluestore-apigw-routing-cdk May 2, 2025
In a real-world scenario:

* The available targets would be maintained in the Key Value Store
* More complex routing logic would be implemented in the CloudFront function (e.g., routing based on user attributes, geographic location, A/B testing scenarios)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't that be a use-case for Lambda@Edge as CloudFront functions have a limit of 5ms and you cannot perform network access to fetch additional data?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, sorry my fault and will update.

Comment on lines 15 to 16
"jest": "^29.7.0",
"ts-jest": "^29.2.5",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be removed as there are no tests

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do

@bfreiberg
Copy link
Contributor

Looks good, thanks for your contribution. Your pattern will be merged to Serverlessland.com soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants