Lambda@EdgeのFunctionを管理する用ライブラリ。 AMIMOTO / Shifter両方での利用を想定しています。
Update package.json
to install the libs.
"dependencies": {
...
"lambda-edge-controller": "git+https://{YOUR_GITHUB_TOKEN}:[email protected]/megumiteam/lambda-edge-controller"
}
And run npm install
command.
// Load libs
const { BandwithLimiter } = require('lambda-edge-controller')
// define lambda arn
const lambdaArn = 'arn:aws:lambda:us-east-1:function:{name}:{version}'
// Initialize the class
const limitter = new BandwithLimiter(lambdaArn)
// To attach bandwith limitter
limitter.attachEdgeFunction('DIST_ID')
.then(result => console.log(result))
// To detach bandwith limitter
limitter.detachEdgeFunction('DIST_ID')
.then(result => console.log(result))
// You can change target event type
limitter.updateEventType('origin-request')
.attachEdgeFunction('DIST_ID')
.then(result => console.log(result))
$ git clone [email protected]:megumiteam/lambda-edge-controller.git
$ cd lambda-edge-controller
$ npm i
$ npm test
$ npm run lint
// auto fix
$ npm run lint -- --fix
$ git tag vX.X.X
$ git push origin vX.X.X