0

I want to create a lambda function in python3.7 that it will use boto to perform some AWS query.

enter image description here

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.

enter image description here

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?

2 Answers 2

3

boto has been deprecated. You should be using boto3.

Import boto3

Sign up to request clarification or add additional context in comments.

Comments

1

This is like adding additional dependencies to aws lambda.

Please follow document to add boto package.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.