CloudFront distributions cache files from AWS S3 for 24 hours by default. When deploying updated files (), it would be nice not to have to wait 24 hours to get the new content. The cached CloudFront content can be "invalidated", and CloudFront allows 1,000 free invalidations per month before charging a tiny fee for each path invalidated.
Add a feature that uses the AWS CloudFront API to automatically invalidate updated files. Only the files uploaded need to be invalidated. Because the deployment logic should already check to see if if the file exists and has changed, we only need to invalidate files that existed before.
As there are many invalidations allowed for free, and because the price for validations is so low, it should probably be turned on by default. Because money is involved, however, a flag should be added to the configuration to allow it to be disabled. (That should be fine for now. More complex invalidations, such as a command-line arguments and individual path invalidations, can be added in the future only if needed.)
This should probably be done in bulk after deployment; this ensures that the most important thing, deployment, occurred successfully. On the other hand, if deployment fails, the existing files will not be invalidated immediately. Then again, if deployment failed invalidation, of the uploaded files is probably the least of the worries. This issue is still open and needs to be decided.