Hivemind
For creating distributed jobs using AWS Lambda functions.
Install:
npm install lambda-hivemind
Use:
const Hivemind = require('lambda-hivemind')
const hivemind = new Hivemind({
func: {
name: 'buzzbuzz',
handler: 'buzzbuzz.sting',
role: '<arn of IAM role to run function under>'
},
accessKeyId: '',
secretAccessKey: ''
awsRegion: 'us-east-1',
data: [
'bee 1',
'bee 2',
'bee 3',
...
],
chunkSize: 10
})
hivemind.publish({
files: [
'buzzbuzz.js'
]
}, {
})
hivemind.on('create', () => {
hivemind.run()
})
hivemind.on('finish', (results) => {
console.log("Woah!")
})
hivemind.on('end', () => {
process.exit(0)
})
hivemind.on('error', (err) => {
console.log("Aww, man!")
})
AWS credentials in constructor are only optional if you have the AWS CLI configured or have your credentials as environment variables!
Full example can be found under test/