Reputation: 40834
I want to create a lambda function in python3.7 that it will use boto
to perform some AWS query.
The function is very simple. I added import boto
to the simple vanilla template to try out how to enable boto
.
import json
import boto
def lambda_handler(event, context):
# TODO implement
return {
'statusCode': 200,
'body': json.dumps('Hello from Lambda!')
}
Needless to say, it fails:
Response:
{
"errorMessage": "Unable to import module 'lambda_function': No module named 'boto'",
"errorType": "Runtime.ImportModuleError"
}
So how can I add boto
to my code?
I have checked out Layers and it is empty.
I think I can create on by uploading a zip file. But what should I put inside the zip file? What sort of directory structure is Lambda expecting?
Upvotes: 0
Views: 6963
Reputation: 22948
boto has been deprecated. You should be using boto3.
Import boto3
Upvotes: 3