Skip to content

Instantly share code, notes, and snippets.

@andrew-templeton
Created April 1, 2016 03:12
Show Gist options
  • Save andrew-templeton/db3f74dd6ce7dc5bac1442a721ce3099 to your computer and use it in GitHub Desktop.
Save andrew-templeton/db3f74dd6ce7dc5bac1442a721ce3099 to your computer and use it in GitHub Desktop.
lambda function to test the IP of your lambda as seen by ifconfig.co
var http = require('http');
exports.handler = function (event, context) {
http.get('http://ifconfig.co', function (res) {
var buff = [];
console.log('Got response: %s', res.statusCode);
res.on('data', function (chunk) {
buff.push(chunk);
});
res.on('end', function () {
console.log('Found: %s', buff.join(''));
context.done();
});
res.on('error', function (err) {
console.error('Got error: %s', e.message);
context.fail();
});
}).on('error', function (e) {
console.log('Got error: %s', e.message);
context.fail();
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment