Search code examples
pythonamazon-web-servicesaws-lambdahandler

Does the python script have to be named as handler.py in AWS Lambda


Does the python script have to be named as handler.py in AWS Lambda?

I can't remember where I read this from, it says lambda is configured to look for a specific file, usually named 'handler.py',just wondering where we can configure this or does it have to be 'handler.py'? Thanks.


Solution

  • You can name this Python script whatever you want. Be sure to reference it properly.

    You can tell the Lambda runtime which handler method to invoke by setting the handler parameter on your function's configuration.

    When you configure a function in Python, the value of the handler setting is the file name and the name of the handler module, separated by a dot. For example, main.Handler calls the Handler method defined in main.py.