This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

cfn-custom-resource-helper
TypeScript icon, indicating that this package has built-in type declarations

0.0.9 • Public • Published

cfn-custom-resource-helper

NPM Version

Helper library for Lambda function as a backend of CloudFormation custom resource.

Can be combined with Serverless Framework.

Usage

See example which creates a S3 object as an custom resource.

Install

npm install --save cfn-custom-resource-helper

Write handler code

const {cfnCustomResource} = require("cfn-custom-resource-helper");

module.exports.cfnCustomResource = (event, context, callback) => {
  cfnCustomResource(event, context, {
    onCreate() {
      /* Code to create resource goes here. */
      /* Please return Promise<{id: "**PhysicalResourceId**", data?: { <data to reference with Fn::GetAtt> }}> */
    },

    onUpdate() {
      /* Code to update resource goes here. */
      /* Please return Promise<{id: "**PhysicalResourceId**", data?: { <data to reference with Fn::GetAtt> }}> */
    },

    onDelete() {
      /* Code to delete resource goes here. */
      /* Please return Promise<{id: "**PhysicalResourceId**", data?: { <data to reference with Fn::GetAtt> }}> */
    },
  }).then(result => {
    callback(undefined, result);
  }).catch(err => {
    callback(err);
  });;
};

Define custom resource

If you use Serverless framework, you can define additional resource on serverless.yml.

Package Sidebar

Install

npm i cfn-custom-resource-helper

Weekly Downloads

1

Version

0.0.9

License

MIT

Last publish

Collaborators

  • y13i