Lambda function wrapper for cfn custom resource hook
npm i --save lambda-cfn-hook
const { wrap } = require('lambda-cfn-hook');
module.exports.hook = wrap((event, context) => {
// do stuff here
}, {/* options */});
and attach the hook
function to a custom resource as a Lambda function in CloudFormation.
silent
boolean: Defaultfalse
. If set totrue
, then no error is thrown if an event is received that isn't originating from a custom resource life-cycle lambda hook. Useful if the lambda handler is multi purpose.
Code is adapted from here.