question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add option for plugin to automatically create a CloudFront invalidation once deployment is complete

See original GitHub issue

This 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:open
  • Created 4 years ago
  • Reactions:6
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
jarizcommented, Jun 25, 2019

@JoshuaWalsh The createCloudfrontInvalidation option seems a bit unnecessary to me (or should at least have a true 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)

0reactions
joshimbrianicommented, Dec 9, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found