1개 답변
- 최신
- 최다 투표
- 가장 많은 댓글
4
To add external Python libraries to your AWS CodeCatalyst Rest API project, you can create a new Lambda layer and upload the required libraries to it. Here are the steps
- Create a directory on your local machine for the layer, and add a subdirectory named "python".
- Inside the "python" directory, create a "site-packages" directory.
- Use pip to install the required external libraries into the "site-packages" directory. For example, you can run the following command to install the "requests" library: pip install requests -t python/site-packages.
- Zip the contents of the "python" directory. You can use the following command to zip the directory: cd python && zip -r ../layer.zip *.
- Upload the resulting "layer.zip" file to AWS Lambda Layers. You can do this through the AWS Management Console or using the AWS CLI.
- Once the layer is uploaded, you can add it to your Lambda function in AWS CodeCatalyst by referencing its ARN in the "Layers" section of the Lambda function configuration.
관련 콘텐츠
- AWS 공식업데이트됨 일 년 전
- AWS 공식업데이트됨 2년 전
- AWS 공식업데이트됨 10달 전
Thank you for the detailed instructions. I had to follow a slightly different directory structure to make it work.
Created a directory named 'python' and installed the library directly under the 'python' directory (didn't require the site-packages subdirectory).
zip (python/library files)