Wrong path in CloudFront invalidation on S3 BucketDeployment
See original GitHub issueI’m using a S3BucketDeployment construct with a CloudFront distribution to deploy static content to a S3 bucket and, on deployment, invalidate items in the CF caches
new s3deploy.BucketDeployment(this, "DeployWebsite", {
sources: [
s3deploy.Source.asset(webAppRoot)
],
destinationKeyPrefix: "web/",
destinationBucket: bucket,
distribution: cdn,
retainOnDelete: false
});
The origin in the CF distribution also specifies /web
as its originPath. Upon deployment a new invalidation is created for the distribution, however the path for the objects to be invalidated is set to /web/*
. Invalidation paths should be relative to the distribution, not to the origin (as per docs).
Reproduction Steps
The code causing the issue is here - https://github.com/dstroppa/aws-modern-application-workshop/blob/2f02430c5036517d34aeadda8e8bea9ffd7507ee/module-1/cdk/lib/web-application-stack.ts#L57
Error Log
N/A
Environment
- CLI Version : 1.9.0
- Framework Version: 1.9.0
- OS : Linux
- Language : Typescript
Other
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Invalidating files - Amazon CloudFront
To invalidate files, you can specify either the path for individual files or a path ... For example: aws cloudfront create-invalidation --distribution-id ...
Read more >Invalidate Cloudfront cache with AWS CDK Pipelines
Is there a workaround? For example, in a non pipeline-process, something like this should work (what I've read): new s3deploy.BucketDeployment( ...
Read more >AWS CDK BucketDeployment — should you use it - Medium
The construct looks like an attractive option for anyone looking at an easy way to manage that deployment and then to invalidate the...
Read more >Deploy a website to S3 and CloudFront with Bitbucket Pipelines
The reason is, CloudFront is caching the all content on all edge locations and serving the content from edge locations. We should “invalidate ......
Read more >awss3deployment - Go Packages
This library allows populating an S3 bucket with the contents of .zip files from other S3 ... The file paths to invalidate in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for looking into this @NGL321. Looks like the changes for #3878 affect CallerReference, but not distributionPaths.
This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.