Ensure you have the following tools installed:
mkdir -p lambda-layer/python/lib/python3.9/site-packages
Navigate to the lambda-layer
directory and install the required packages into it:
cd lambda-layer
pip3 install pandas numpy ccxt -t python/lib/python3.9/site-packages/
Package the Lambda layer:
zip -r atlas_trade_layer_one_dependencies.zip .
Use the AWS CLI to publish the layer:
aws lambda publish-layer-version \\
--layer-name atlas-trade-layer-one-dependencies \\
--zip-file fileb://atlas_trade_layer_one_dependencies.zip
Once the layer is uploaded, AWS will provide an ARN (Amazon Resource Name) for the layer. You can use this ARN to associate the layer with your Lambda function.
In your serverless.yml
(or AWS Console / AWS SAM / CloudFormation), include the layer ARN to link your Lambda function to the layer:
layers:
- arn:aws:lambda:<REGION>:<ACCOUNT_ID>:layer:python-dependencies-layer:<VERSION>