Skip to content

Instantly share code, notes, and snippets.

@yeisoncruz16
Created March 3, 2021 17: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 yeisoncruz16/0027c654d8c4213b77325b5407c0dbff to your computer and use it in GitHub Desktop.
Save yeisoncruz16/0027c654d8c4213b77325b5407c0dbff to your computer and use it in GitHub Desktop.
Simple lambda function to get Current IP
let response;
exports.lambdaHandler = async (event, context) => {
try {
const ret = await axios(url);
response = {
'statusCode': 200,
'body': JSON.stringify({
location: ret.data.trim()
})
}
} catch (err) {
console.log(err);
return err;
}
return response
};
@yeisoncruz16
Copy link
Author

Also you can use the AWS endpoint

http://checkip.amazonaws.com/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment