Created
September 12, 2014 17:45
-
-
Save manuelcabral/e7438ca8e8994de7bdfb to your computer and use it in GitHub Desktop.
Cloudfront invalidations in Node.js with aws-sdk
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aws = require('aws-sdk') | |
accessKeyId = "" | |
secretAccessKeydistribution = "" | |
region = 'us-east-1' | |
distribution = "" | |
items = [ '/index.html' ] | |
cf = new aws.CloudFront(new aws.Config({ accessKeyId, secretAccessKeydistribution, region })) | |
invalidations = items.map(encodeURI) | |
params = | |
DistributionId: distribution | |
InvalidationBatch: | |
CallerReference: '' + +new Date | |
Paths: | |
Quantity: invalidations.length | |
Items: invalidations | |
cf.createInvalidation params, (err, data) -> | |
#done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment