lulo
lulo is a tiny plugin based framework for working with AWS CloudFormation Custom Resources. lulo itself doesn't do much but is easily extended by registering plugins.
Installation
$ npm install lulo --save
Plugins
lulo doesn't provide any CustomResources out of the box so you have to install the plugins you want and register them (see usage below).
For a complete list of available plugins, see the plugin page.
Contribute Plugins
Want to contribute with your own plugins? Check out the How to write plugins page
Usage
Example Lambda index.js
import { Lulo } from 'lulo';
import { CloudFormationCustomResourceEvent, Context } from 'aws-lambda';
import * as myPlugin from 'my-plugin';
const lulo = new Lulo()
.register('MyPlugin', myPlugin);
export async function handler(event: CloudFormationCustomResourceEvent, context: Context): Promise<void> {
await lulo.handler(event, context);
}
Package your index.ts and node_modules and deploy to Lambda (nodejs18.x runtime or later).
Configuration
Lulo offers a small set of configuration parameters:
- logEvent: Set to true if you want to log the incoming Lambda event to CloudWatch Logs
- logResponse: Set to true if you want to log the outgoing CloudFormation response to CloudWatch Logs
- maskedProperties: Array or property names that you want masked when logging events. Note that these do not apply to the response logging.
AWS CloudFormation template
{
"MyCustomResourceName": {
"Type": "Custom::PluginNameSpace",
"Properties": {
"ServiceToken": "{LAMBDA_ARN}",
...
}
},
"MyOtherCustomResourceName": {
"Type": "Custom::AnotherPluginNameSpace",
"Properties": {
"ServiceToken": "{LAMBDA_ARN}",
...
}
}
}
See the example for a complete example
How it works
When you register a plugin you have to give it a name.
To invoke the plugin you reference the plugin name in your CloudFormation template: Custom::RegisteredPluginName
.
Each plugin works in different ways and may yield different types of results that you can interact with in your templates. Please refer to the plugin specific documentation for further details.
If you have private plugins that you don't want to publish as npm modules it's perfectly fine to bundle those with your Lambda function as long as they expose the same API as a regular plugin.
Why Lulo?
Because it's a very healthy fruit :)