ChumiestBucket
ChumiestBucket

Reputation: 1074

looking for a way to upgrade / downgrade inside Lambda

I need a way to upgrade/downgrade the boto3 lib inside my Python 3.7 env inside Lambda.

Right now, the version is 1.9.42 inside Lambda. I cannot use certain things like Textract (boto3.client('textract'), but I can on my local machine (boto3 version 1.9.138.

So, I decided to install boto3 into a package (pip3 install boto3 -t dir/ --system) then upload it to Lambda after zipping it.

This didn't work because Lambda won't accept a package larger than 3MB (it's around 8MB)

Any other workarounds?

edit: I know I could always just write code that works and keep uploading it to Lambda, but this will become cumbersome as I'd have to include all the packages installed in the package and rebuilding it as I make changes.

Upvotes: 0

Views: 472

Answers (1)

amaurs
amaurs

Reputation: 1632

The Serverless Application Model is a tool provided by AWS that lets you develop locally as it simulates the lamdba environment inside a docker container. Once you are ready you can deploy your code to a lambda and it will work as expect.

If you really want to keep editing the code in the web platform, there is a workaround by using lambda layers. You create a package with all of your dependencies and upload that to a lambda layer. Then include your layer in the lambda and just modify your own code there. As it has been pointed out in the comments this is not the way to go for real development.

Upvotes: 1

Related Questions