Cloudfront.invalidatePaths()

Invalidate one or more paths within a CloudFront distribution.

Use this machine when you want to delete objects from CloudFront, forcing it to pull fresh copies of those files from your origin server/bucket.

Usage

Hover over inputs/exits for more info.

var Cloudfront = require('machinepack-cloudfront');


// Invalidate one or more paths within a CloudFront distribution.

Cloudfront.invalidatePaths({

accessKeyId: 'BJIBJB5SF3Z5QQDJFHHX',

secretAccessKey: 'JOpq29vhaJ2VVae2jfkN/+z9/ulqRzd',

distribution: 'E672U0C5WS3M1',

paths: [ '/images/foobar.jpg' ],

region: 'us-east-1',

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// The security credentials specified as inputs are invalid.

invalidCredentials: function () {

 

},

// The specified distribution does not exist.

unknownDistribution: function () {

 

},

// OK.

success: function () {

 

},

});

Inputs

accessKeyId required

Your AWS access key id

'BJIBJB5SF3Z5QQDJFHHX'
secretAccessKey required

Your AWS secret

'JOpq29vhaJ2VVae2jfkN/+z9/ulqRzd'
distribution required

The unique id of the CloudFront distribution containing the paths to invalidate.

'E672U0C5WS3M1'
paths required

The paths to invalidate, relative to this distribution (each one starting with a leading slash)

[ '/images/foobar.jpg' ]
region

Your AWS region (defaults to "us-east-1")

'us-east-1'

Exits

error

An unexpected error occurred.

invalidCredentials

The security credentials specified as inputs are invalid.

unknownDistribution

The specified distribution does not exist.

success

OK.