cloudfront-api-update
v1.0.2
Published
Package that will update CloudFront Distribuions with API gateway endpoints as origins
Downloads
6
Readme
cloudfront-api-update
Features
This plugin can be used to update your CloudFront Distribution with API Gateway Origins and Cache Behaviors, so that the API gateway endpoints can be served through CloudFront.
Install Plugin
npm install --save cloudfront-api-update
Using the Plugin
Require the module in your script.
const cau = require("cloudfront-api-update")
;Configure the required params. Note that
Origins
is an array, and there can be multiple Origins in the form of multiple objects.
const params = {
"DistributionId": "DISTRIBUTION_ID",
"Origins": [{
"DomainName": "api-id.execute-api.region.amazonaws.com",
"OriginPath": "",
"PathPattern": "/v1/api/*"
}
]
}
- Run the
updateDistribution
method to update your CloudFront Distribution.
cau.updateDistribution(params.DistributionId, params.Origins)
.then(results => {
console.log(results);
}).catch(error => {
console.error(error);
})