How to downgrade the boto3 version in an AWS Lambda Function

A directory will not be a module/package. The approach you're using will never work.

Instead of all this, create a virtual environment using the desired Python version - possibly within docker, wherein you install the packages. Then you'll have to zip the lib folder from the virtual environment so that when unzipped the layer will produce the directory structure similar to


The top-level directory must be named python for this to work.

If you do this correctly, then you should be able to import your version of boto3 normally.