-
Notifications
You must be signed in to change notification settings - Fork 422
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
Invalidate CF distribution on deploy of static site #5024
Comments
Hi, @yannickvr. |
I would argue that invalidating all by default would be good standard behavior, but an option to exclude/include certain files/folders could be high on the wishlist. E.g. I would normally be fine with my |
Hello @yannickvr.
Basically if we support doing invalidation by default after each deployment, you would want to exclude certain files/folders because very likely they won't change and doing invalidation for them will lead to extra invalidation time? |
Exactly, though doing some research, I'm not completely sure if that makes sense. It seems that a wildcard invalidation |
) One of the ways in which CloudFront reduces latency is by caching objects at edge locations, reducing the number of requests that users’ origin servers must respond to directly. For Copilot-managed Static Site services, this caching behavior has the unfortunate side effect of redeployments using cached— and out-of-date— versions of source files. By default, files expire after 24 hours. We want users to benefit from edge caches, so we don’t want to [manage cache expiration](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Expiration.html) by changing TTL values or the [cache policy](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html). Instead, we can allow the caching but [invalidate the cache](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html) each time the Static Site service is redeployed, after (updated) files are uploaded. This way, the updated files are served from the origin server rather than the outdated cached files. We opted to invalidate all files (`/*`) for simplicity, efficiency, and [cost-savings](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html#PayingForInvalidation). If, in the future, customers request the ability to exclude files from invalidation, we can consider adding that config to the workload manifest. Resolves: #5024. By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the Apache 2.0 License.
This enhancement has now been released in v1.29.0: https://github.com/aws/copilot-cli/releases/tag/v1.29.0! |
The Static Site Service does currently not invalidate existing assets on the cloudfront distribution when redeploying the service, so e.g. when index.html is updated to add a new menu item, it's not immediately visible.
I think there should be an invalidations option for the static site service, e.g.
The text was updated successfully, but these errors were encountered: