Know How Guide and Hands on Guide for AWS
The official guide for AWS Lambda layers
Note: A function can use up to 5 layers at a time. The total unzipped size of the function and all layers can’t exceed the unzipped deployment package size limit of 250 MB.
publish-layer-version
commandFor example, create layer for pandas
rm -r *.whl pycache chmod -R 755 . && cd .. #This name is very important. Please ensure that the zip name is exactly that zip -r9 python.zip python
2. publish layer
```bash
aws s3 cp python.zip s3://ray-glue-streaming/catalog_test/lambda_code/python.zip --region cn-north-1
aws lambda publish-layer-version --layer-name python38_pandas_layer --description "pandas layer for python 3.8" --license-info "MIT" \
--content S3Bucket=ray-glue-streaming,S3Key=catalog_test/lambda_code/python.zip --compatible-runtimes python3.8 --region cn-north-1
aws lambda delete-layer-version --layer-name python38_pandas_layer --version-number 1
aws lambda add-layer-version-permission --layer-name python38_pandas_layer \
--statement-id xaccount --action lambda:GetLayerVersion \
--principal target_account_id --version-number 1 --output text --region cn-north-1
aws lambda list-layers --compatible-runtime python3.8 --region cn-north-1
By lambda console:
By aws CLI:
aws lambda update-function-configuration --function-name lambda_handle_complex_csv \
--layers arn:aws-cn:lambda:cn-north-1:layer-account-id:layer:python38_pandas_layer:1 \
--region cn-north-1 --profile second-cn
aws lambda update-function-configuration --function-name lambda_handle_complex_csv --layers [] --region cn-north-1 --profile second-cn