This repository was archived by the owner on Jan 28, 2025. It is now read-only.
CloudFront Support #95
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
CloudFront Support
Motivation
Currently, API Gateway is being used as a proxy to S3 to serve static assets from
/static
and/public
directories. Whilst this works, is not the best solution as API Gateway is not as cost effective as CloudFront, nor is designed to be used as a CDN.Also CloudFront comes with features such as compression, logging, domains, certificates etc.
Proposal
When
cloudFront
flag is set to true, a CloudFront distribution is created with API Gateway and S3 as origins._next
build assets andstatic/
orpublic/
folder assets are served from the S3 origin. Page requests, such as/blog/:post
are served from the API Gateway origin.This article was used as a reference for implementation:
https://aws.amazon.com/premiumsupport/knowledge-center/api-gateway-cloudfront-distribution/