简体   繁体   中英

AWS lambda zappa not using latest boto3 version

I have a flask app that I deploy to AWS lambda. This application requires the latest version of boto3 (1.9.71) , however, when deploying the application with zappa it does not use the latest version.

Here is the current setup:

from flask import Blueprint
import boto3

bp_routes = Blueprint('simple_routes', __name__)


@bp_routes.route('/test_boto')
def test_boto():
    return f'BOTO VERSION: {boto3.__version__}'

The requirements.txt :

flake8==3.7.7
Flask==1.0.2
flask-script==2.0.6
python-dotenv==0.10.1
yapf==0.27.0
zappa==0.48.2
botocore==1.12.71
boto3==1.9.71

Running the application locally with flask run and browsing to the route http://127.0.0.1:5000/test_boto I get

BOTO VERSION: 1.9.71

However, when deploying it to AWS lambda with zappa update and then browsing there I get

BOTO VERSION: 1.9.42

Does anyone know how to fix this?

Zappa excludes boto3 by default because its included in the lambda environment. A fudge that worked for me previously was add a pattern that won't match anything to the exclude field in zappa_settings.json this then caused zappa to include my bundled boto3.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM