0 votes
1 view
in AWS by (18.2k points)

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

1 Answer

0 votes
by (42.5k points)

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';

    ...

};

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...