1

I have a Lambda function that will be used to essentially curl a web address every minute. In order to do that I'm using the python Requests library. The problem I'm running into is how do I install the package on AWS like I'm able to do locally.

I came across Zappa and it looks to be what I need but I'm having issues configuring it. I went through the install steps for zappa, downloaded the aws-cli and setup the aws api credentials. This is the error message I'm getting -

$ zappa deploy production
Calling deploy for stage production..
Downloading and installing dependencies..
Packaging project as zip.
Error: Your app_function value is not a modular path. It needs to be in the format `your_module.your_app_object`.

In my zappa_settings.json -

{
    "production": {
        "app_function": "something", 
        "aws_region": "us-east-1", 
        "profile_name": "default", 
        "project_name": "something", 
        "runtime": "python2.7", 
        "s3_bucket": "company-lambda",
        "lamda_handler": "app.lambda_handler"
    }
}

In that directory I have -

  • app.py
  • zappa_settings.json

In app.py -

def lambda_handler(event, context):
   print('hello')
3
  • 1
    Zappa is primarily used to 'host' Python WSGI apps on API Gateway and Lambda, so it's typically for migrating an existing Flask/Django app, and those would have app objects. Why don't you simply include the requests package in your uploaded ZIP file, per the example at docs.aws.amazon.com/lambda/latest/dg/…. Commented Feb 8, 2018 at 21:00
  • That works, thank you! Commented Feb 8, 2018 at 21:22
  • Great, I'll turn it into an answer. Commented Feb 8, 2018 at 21:27

1 Answer 1

1

Zappa is primarily used to host Python WSGI apps on API Gateway and Lambda, so it's typically for migrating an existing Flask/Django app, and those would have app objects.

If you don't need that level of function, and simply want to include a few Python packages with your Lambda function, then simply include the packages in your uploaded ZIP file, per the AWS example that actually packages up requests, using:

pip install requests -t /path/to/project-dir
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.