Skip to content

Instantly share code, notes, and snippets.

@ataube
Created May 12, 2017 20:01
Show Gist options
  • Save ataube/206f1b5292e04dd7c2c9acd8382a96a6 to your computer and use it in GitHub Desktop.
Save ataube/206f1b5292e04dd7c2c9acd8382a96a6 to your computer and use it in GitHub Desktop.
Lambda exec example
const AWS = require('aws-sdk');
const lambda = new AWS.Lambda({ region: 'eu-central-1', endpoint: 'http://localhost:3050' });
const params = {
FunctionName: 'hello-world',
InvocationType: 'RequestResponse',
Payload: JSON.stringify({
queryStringParameters: {},
headers: {},
}),
Qualifier: '$LATEST',
};
lambda.invoke(params, (err, data) => {
if (err) {
console.log('Error', err);
return;
}
console.log(data.Payload);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment