Skip to content

Lewenhaupt/aws-cloudformation-custom-resource

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

aws-cloudformation-custom-resource

npm version npm Vulnerabilities License

Helper for managing custom AWS CloudFormation resources in a Lambda function.

Usage

import { CustomResource, Event, StandardLogger } from 'aws-cloudformation-custom-resource';
import { Callback, Context } from 'aws-lambda';
import AWS = require('aws-sdk');

export const handler = function (event: Event, context: Context, callback: Callback) {
    new CustomResource(context, callback)
        .onCreate(Create)
        .onUpdate(Update)
        .onDelete(Delete)
        .handle(event);
};

function Create(event: Event): Promise<Event | AWS.AWSError> {
    return new Promise(function (resolve, reject) {
        // do stuff
        resolve(event)
    });
}

function Update(event: Event): Promise<Event | AWS.AWSError> {
    return new Promise(function (resolve, reject) {
        // do stuff
        resolve(event)
    });
}

function Delete(event: Event): Promise<Event | AWS.AWSError> {
    return new Promise(function (resolve, reject) {
        // do stuff
        resolve(event)
    });
}

About

Helper for managing custom AWS CloudFormation resources in a Lambda function.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 100.0%