Lambda Function for Adding Encoding Tasks to the RabbitMQ Instance on CreateObject Event in AWS S3.
The project needs amqplib
in order to interact with RabbitMQ which isn't already present in the lambda environment.
So we have to add the library as a layer in lambda for the function.
Follow the instructions below to create a lambda layer for adding amqplib
to the function.
mkdir nodejs
cp -r node_modules/ nodejs/
zip -r amqplib.zip nodejs/
Now go to AWS Lambda to create a new lambda layer with amqplib.zip
.
Once the layer has been created, assign it to the desired lambda function.
Note
We could containerize the lambda function and run it on AWS without any layer management by using ECR. I have added a Dockerfile just for that; however, I haven't personally tested it. Read More