1.0.2 • Published 6 years ago
cloudfront-api-update v1.0.2
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
1) Require the module in your script.
`const cau = require("cloudfront-api-update")`;
2) 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/*"
}
]
}
3) 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);
})