Deploy Lambda Function and API Gateway REST


I deployed an API Gateway REST API and a Lambda function using Terraform. REST API testing tool threw below error when I invoked the HTTP endpoint. lambda add-permission was applied. "message": "Internal server error". And CloudWatch shows this error: [ERROR] Runtime.ImportModuleError: Unable to module 'my-lambda': No module named 'my-lambda'

  • Inside of your my-lambda lambda, are you trying to import a module called my-lambda?

  • my-lambda is just a lambda function name. it only has below imports import json import os

2 Answers
0 should be the name of the file that has the handler.

profile pictureAWS
answered 2 years ago

See the above answer from Uri. Your zipped file and the contents should have the name of the handler. We wrote a blogpost about this, in case it helps.

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions