1.0.0 • Published 7 years ago

lambda-cfn v1.0.0

Weekly downloads
2
License
BSD-2-Clause
Repository
github
Last release
7 years ago

lambda-cfn

Build Status

Quickly define Lambda functions and supporting resources via a javascript CloudFormation template.

Synopsis

In a file named like myTemplate.template:

var lambdaCfn = require('lambda-cfn');

module.exports = lambdaCfn(
  [
    'myHandler.js',
  ],
  {
    "AWSTemplateFormatVersion": "2010-09-09",
    "Description": "my stack"
  }
);

where in myHandler.js you've exported:

  • module.exports.fn - a function which takes in event, context, callback and which will get called by Lambda. See lambda documentation for help on using context or the callback.
  • module.exports.config - allows you to define some configuration for your Lambda function. See the rules spec for all options.

After uploading a zip of your project to a location in Lambda, you can then deploy this javascript CloudFormation template with cfn-config to deploy your function.

See the patrol README for more examples and the rules spec for a complete reference.

Why

AWS Lambda simplifies deploying code on AWS by eliminating the need to run EC2s. However, you still need to:

  • Monitor the function and know when it fails
  • Grant the function proper IAM policy permissions
  • Schedule the function, or connect it to an event source
  • Capture all of this in a CloudFormation template

lambda-cfn provides for a simplified interface for defining all of the above, and when used in combination with cfn-config, offers a command line interface for deploying and updating the CloudFormation template in which your lambda functions and supporting resources are captured.

Instead of directly writing a CloudFormation template, cfn-config is able to read a javascript file, and, if that javascript file implements lambda-cfn, cfn-config + lambda-cfn turn that file into a valid CloudFormation template.

lambda-cfn adheres to a rules spec in order for a Lambda function, supporting resources, and configuration to be defined in javascript files, which can then be expanded into CloudFormation template JSON.

Basic use

Refer to the patrol README, and especially its "getting started" guide for an example usage of lambda-cfn.

1.0.0

7 years ago

0.1.5

7 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago

0.0.10

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago