I fired up an ec2-instance and connected to it.
-needs to be updated with creation of virtual environment-
```code bash sudo su mkdir my-lambda-layer && cd my-lambda-layer mkdir -p aws-layer/python/lib/python3.7/site-packages pip3 install beautifulsoup4 --target aws-layer/python/lib/python3.7/site-packages
This concludes the PIP-installation now we need to create the zip file.
## Create zip-file
```code bash
cd aws-layer
zip -r9 lambda-layer.zip .
Don't forget to include the "." at the end.
After zipping the packages it will have the name “lambda-layer.zip”
To create the lambda layer automatically using the AWS CLI you can use the command below:
code bash
aws lambda publish-layer-version \
--layer-name Data-Preprocessing \
--description "My Python layer" \
--zip-file fileb://lambda-layer.zip \
--compatible-runtimes python3.7
Now you can use your layer in your lambda functions.