Comments (5)
is there a way to upgrade this yourself?
from docker-lambda.
There's probably a way.
Note that the normal image doesn't include pip. The build one does though.
Note also that the version of botocore and boto3 in lambda tends to lag behind the latest version of the libraries. So you can't simply upgrade to the latest, you must pin the versions. I was hoping that's something that this project would handle for me, by just copy-pasting the files from the Lambda runtime regularly.
from docker-lambda.
I worked around this now with the wonderful blog post from https://www.mandsconsulting.com/lambda-functions-with-newer-version-of-boto3-than-available-by-default/
effectively just boils down to prioritize the pip installed packages before importing them:
if "LAMBDA_TASK_ROOT" in os.environ:
envLambdaTaskRoot = os.environ["LAMBDA_TASK_ROOT"]
sys.path.insert(0, "/var/lang/lib/python3.9/site-packages")
import boto3
import botocore
It's a real shame that the runtime does not do this itself before executing the script.
from docker-lambda.
You can add a layer with updated packages
On Linux:
mkdir -p lambda_layer/python
cd lambda_layer/python
pip install boto3 -t ./
pip install botocore -t ./
cd ..
zip -r ~/lambda_layer.zip .
after that upload lambda_layer.zip as a layer to your function (it is relatively small so no need to store on S3)
from docker-lambda.
From memory boto3 and botocore and not relatively small. They're like 60MB, right? So that's 1/8th of the size quota gone just to the AWS SDK. If you're trying to also squeeze in some other library like matplotlib or awswrangler, that's going to pose a challenge for real deployments.
Although this project is for unit testing. so size isn't an issue. the issue is just that the docker container doesn't accurately reflect the environment its emulating. Installing the latest version of boto3 and botocore won't either, since real lambda tends to lag the latest SDK versions.
Also, you should probably install boto3 and botocore in one single pip command, to ensure the two versions are compatible with each other.
from docker-lambda.
Related Issues (20)
- Missing files from provided.al2 HOT 1
- Need support for python3.9 HOT 10
- nodejs16.x support HOT 6
- Golang update to 1.17 HOT 1
- Is java11 image on AL2 and Corretto?
- How can I build image for python3.9 runtime? HOT 4
- Help with Debugging Go Lambda HOT 1
- Rebuild images? HOT 2
- What is the status of this project? HOT 7
- Make `myfunction` and `9001` configurable?
- Support for Node 14.x? HOT 1
- Require image for ARM64 architecture
- Support for .NET 6
- Multi-arch support specially arm64 HOT 1
- Current ruby release (v2.7.2p137) out of date (now v2.7.6p?) HOT 1
- Missing .py file causing attributeError on lambda
- Jenkins agent install on lambci/lambda:build-python3.7 HOT 2
- Debugging with Pycharm
- [Question] Support for Provided Runtimes (Namely C++)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker-lambda.