Overriding environment variables that are reserved by AWS Lambda might lead to unexpected behavior or failure of the Lambda function.
1def create_variable_noncompliant():
2 import os
3 # Noncompliant: overrides reserved environment variable names
4 # in a Lambda function.
5 os.environ['_HANDLER'] = "value"
1def create_variable_compliant():
2 import os
3 # Compliant: prevents overriding reserved environment variable names
4 # in a Lambda function.
5 os.environ['SOME_ENV_VAR'] = "value"