Add option for plugin to automatically create a CloudFront invalidation once deployment is complete
See original GitHub issueThis was discussed briefly in #47. Currently in our “with CloudFront” recipe and in my blog post we recommend invalidating the CloudFront cache after the deployment.
The mechanism suggested for this is to use the shell’s && operator to execute both commands:
gatsby-plugin-s3 deploy --yes && aws cloudfront create-invalidation --distribution-id EXAMPLEDISTRIBUTIONID --paths \"/*\"
This is clunky, it would be nice to have gatsby-plugin-s3 take care of this.
By default I think we should NOT wait for the invalidation to complete, as this may take a long time. We could also add an option to wait for the invalidation to complete.
I suggest these options and defaults:
{
'cloudfrontDistributionId': undefined,
'createCloudfrontInvalidation': false,
'waitForCloudfrontInvalidation': false
}
Issue Analytics
- State:
- Created 4 years ago
- Reactions:6
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Invalidating files - Amazon CloudFront
Select the distribution for which you want to invalidate files. · Choose Distribution Settings. · Choose the Invalidations tab. · Choose Create Invalidation....
Read more >Automating Cloudfront invalidations in an continous ...
A workaround for this delay is to create an “invalidation” - basically telling Cloudfront that the cached versions of specific files are now ......
Read more >Automatic CloudFront Invalidation for S3 Origins [Solved]
Automatic Invalidation · Create a Lambda function that: Finds the CloudFront distribution associated with a given S3 bucket; Submits an ...
Read more >Best Practices for WordPress on AWS - Awsstatic
Customers are responsible for making their own independent assessment of the ... with Amazon S3 and CloudFront out of the box, a variety...
Read more >Amazon CloudFront - Developer Guide
Some ad-blocking plugins for web browsers interfere with Amazon CloudFront console ... After the deployment is complete, create a DNS record to point...
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 Free
Top 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
@JoshuaWalsh The
createCloudfrontInvalidation
option seems a bit unnecessary to me (or should at least have atrue
default).If you’ve configured a CF dist ID, surely you want the plugin to invalidate it? (what other point would there be to setting this)
Sure enough! Thanks for pointing that out, I spent the last 2 days wracking my brain trying to figure out a workaround. I’d still love to implement this feature since presumably if you don’t have to invalidate everything, it’s better for performance.