Licence
MIT
Version
1.0.2
Deps
2
Size
8 kB
Vulns
1
Weekly
0
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
Originsis 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
updateDistributionmethod to update your CloudFront Distribution.
cau.updateDistribution(params.DistributionId, params.Origins)
.then(results => {
console.log(results);
}).catch(error => {
console.error(error);
})