gatsby-uc/gatsby-plugin-s3

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

Open

#68 opened on May 25, 2019

View on GitHub
 (5 comments) (6 reactions) (0 assignees)TypeScript (104 forks)github user discovery
enhancementgood first issue

Repository metrics

Stars
 (206 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

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
}

Contributor guide