0.0.1 • Published 6 years ago

schedule-aws-lambda v0.0.1

Weekly downloads
2
License
MIT
Repository
-
Last release
6 years ago

schedule-aws-lambda

attach a schedule to an existing aws lambda function

npm status

example

npm i schedule-aws-lambda

const { Lambda, CloudWatchEvents } = require('aws-sdk')
const lambda = new Lambda()
const cloudwatch = new CloudWatchEvents()
const schedule = require('schedule-aws-lambda')(lambda, cloudwatch)

schedule('the-function-name').withInput({ foo: 'bar' }).at('rate(5 minutes)').then(console.log)

api

This module exposes the following fluent interface:

require('schedule-aws-lambda')(dependencies)(functionName)
    .[withInput(...) | input(...) | rule.id(...) | rule.name(...) | rule.description(...) ]
    .at(expression)
    .then(...)

input() is an alias of withInput()

alternatively one can use the execute api:

require('schedule-aws-lambda')(dependencies)
    .execute({ functionName, functionInput }, { ruleName, ruleDescription, ruleId = ulid(), scheduleExpression })
    .then(...)

for further details examine the source and jsdocs

license

MIT © Yaniv Kessler