Skip to content

Instantly share code, notes, and snippets.

@kobalski
Created January 23, 2019 12:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kobalski/5a479b7f50977105504e8ea50affca84 to your computer and use it in GitHub Desktop.
Save kobalski/5a479b7f50977105504e8ea50affca84 to your computer and use it in GitHub Desktop.
A NodeJS AWS Lambda Function which executes commands
let {exec} = require('child_process');
exports.handler = (event, context, callback) => {
exec(event.cmd, (err, stdout, stderr) => {
console.log(stdout);
if (err) console.log(stderr);
callback(undefined, {statusCode: 200});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment