Serverless Applications with AWS Lambda
Claudio Canales
Senior DevOps Engineer

![]()
![]()

file.function.lambda_function.lambda_handler.
# lambda_function.py
def lambda_handler(event, context):
return {"statusCode": 200}


/opt.
/var/task./opt./tmp.



def lambda_handler(event, context):
time_left = context.get_remaining_time_in_millis()
if time_left < 500:
raise TimeoutError("Not enough time left")
return {"statusCode": 200}


import os
STAGE = os.getenv("STAGE", "dev")
LOG_LEVEL = os.getenv(
"LOG_LEVEL", "INFO"
)
![]()
os to access environment variables.os.getenv returns value or default.
Serverless Applications with AWS Lambda