Back
I want to detect if my code is getting executed in AWS Lambda environment. Is there a good, documented way to do it?
Currently, I'm depending on the existence of environmental variable LAMBDA_TASK_ROOT which was described in the Exploring The AWS Lambda Runtime Environment blog post which feels wrong
After the lambda entry point, you can set a Global variable or an Environment variable so that you can track manually. In node.js it is like this:
exports.handler = function(event, context, callback) { process.env['LAMBDA_ENV'] = 'true'; ...};
exports.handler = function(event, context, callback) {
process.env['LAMBDA_ENV'] = 'true';
...
};
Learn how we helped 50,000+ professionals like you !
31k questions
32.8k answers
501 comments
693 users