Created
October 2, 2015 00:48
-
-
Save johntitus/182d7be6876ec162c9e7 to your computer and use it in GitHub Desktop.
Get the public ip address of an AWS Lambda
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
exports.handler = function( event, context ){ | |
http.get({'host': 'api.ipify.org', 'port': 80, 'path': '/'}, function(resp) { | |
resp.on('data', function(ip) { | |
context.succeed(ip.toString()); | |
}); | |
resp.on('error', context.fail); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment