Layers in Lambda
Layers are useful for importing the libraries which not listed in aws.
Consider you want to import pymysql lib for your RDS connection or pymongo for your Mongodb database connection, if you are not added them as layer these libraries are not available
Creating the layer:
step1: Open your terminal and create a folder give a proper name (lambda_pymysql_layer..)
step2: change directory to lambda_pymysql_layer then create folder name should be python
mkdir lambda_pymysql_layer
cd lambda_pymysql_layer
mkdir python
mkdir python
stpe3: pip3 install pymysql -t ./ (install your package in the current directory)
step4: Then zip your folders
step5: Zip the folder from python directory
step6: import this zip in add files of lambda function
step7: import pymysql
Comments
Post a Comment