The instructions for setting up a layer
installation for lambda
have us zip up a fresh python installation https://docs.aws.amazon.com/lambda/latest/dg/python-layers.html
Run the 2-package.sh script using the following command:
./2-package.sh
This script copies the contents from the create_layer/lib directory into a new directory named python. It then zips the contents of the python directory into a file named layer_content.zip. This is the .zip file for your layer. You can unzip the file and verify that it contains the correct file structure, as shown in the Layer paths for Python runtimes section.
Example 2-package.sh
mkdir python
cp -r create_layer/lib python/
zip -r layer_content.zip python
My actual redacted command
$aws lambda publish-layer-version --layer-name python-requests-layer
--content S3Bucket=lambda-experiments,S3Key=layer_content.v01.zip --compatible-runtimes python3.11 --compatible-architectures "arm64"
Results:
An error occurred (InvalidParameterValueException) when calling the PublishLayerVersion operation: Unzipped size must be smaller than 262144000 bytes
So then if the python
installation is too large, what is the way that layers
are supposed to be configured and used?