1 Answer
- Newest
- Most votes
- Most comments
1
Hello.
I think it is a good idea to upload files that can be installed with pip, such as "boto3", as a layer as described in the document below.
https://docs.aws.amazon.com/lambda/latest/dg/packaging-layers.html
https://docs.aws.amazon.com/lambda/latest/dg/creating-deleting-layers.html
Other classes such as "spelling_correction" are probably unique classes created in Python, so I think you can use them for now by uploading them together with "lambda_function.py" in a zip file.
https://docs.aws.amazon.com/lambda/latest/dg/python-package.html
Once you get used to operating AWS, I recommend using IaC such as AWS SAM.
https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/what-is-sam.html
Relevant content
- asked 2 years ago
- asked 4 months ago
- AWS OFFICIALUpdated 3 months ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 3 years ago
- AWS OFFICIALUpdated 2 years ago
I have created 2 layers for symspellpy and boto3 libraries separately, but I still get this error
"errorMessage": "Unable to import module 'lambda_function': No module named 'symspellpy'",
Can you help me to figure out, please?
For creating layers using Docker containers, please refer to the answer at the following URL. https://repost.aws/questions/QUmvP42wYQRiyOJmvDI5MVtA/error-while-running-python-code-in-aws-lambda-function#ANQ8ctoPV9Q72nMUr5mh8ulg
Also, if you are using the Lambda Python runtime, I don't think you need to create a layer since boto3 is installed. https://docs.aws.amazon.com/lambda/latest/dg/lambda-python.html
Thanks a lot for great information sources! The problem was python3.11 version incompatibility with symspellpy library. Now it works.