Site icon Machine Learning Projects

How to Deploy a Lambda function as a Component on an Edge Machine using AWS Greengrass v2 – 2022

Machine Learning Projects

Recently I was trying to deploy a Lambda function as a component on an Edge Machine using AWS Greengrass v2 for a client and you won’t believe I have never done such a frustrating task in my life. After doing it wrong for about 30-40 times I finally deployed it 🙂

And this is what today’s blog is about. I don’t want anyone else to face the same frustration that I faced while doing this process. So without any further due let’s do it…

Step 1 – Create a Lambda Function.

pip install loguru -t .

Note – AWS Greengrass v2 is compatible with Python 3.7 and Python 3.8 but not Python 3.9.

Step 2 – Create versions and alias for our Lambda Function.

Step 3 – Make a Component in AWS Greengrass using this Lambda Function.

Deploy a Lambda function as a Component on an Edge Machine using AWS Greengrass v2
Deploy a Lambda function as a Component on an Edge Machine using AWS Greengrass v2

Note – There is one more very important configuration present here. Its name is Pinned Lambda. Pinned Lambda means it is long-living Lambda and it will not stop unless stopped explicitly. If you have a use case in which you have to continuously do some work or continuously assess something, write your code inside a while loop in lambda_function.py, make your component pinned lambda, and do all other steps same.

Step 4 – Deploy a Lambda function as a Component on an Edge Machine using AWS Greengrass v2.

Deploy a Lambda function as a Component on an Edge Machine using AWS Greengrass v2

If everything you did till now fits in place you have successfully deployed your component on the Edge device.

sudo -i
// Enter your password
cd /greengrass/v2/logs/
ls -lrt
Deploy a Lambda function as a Component on an Edge Machine using AWS Greengrass v2
more <log file name> 

And this is how you Deploy a Lambda function as a Component on an Edge Machine using AWS Greengrass v2.

Do let me know if there’s any query while you deploy a Lambda function as a component on an Edge Machine using AWS Greengrass v2 by contacting me via email or LinkedIn.

So this is all for this blog folks, thanks for reading it and I hope you are taking something with you after reading this and till the next time ?…

Read my previous post: How to build OpenCV with Cuda and cuDNN support in Windows

Check out my other machine learning projectsdeep learning projectscomputer vision projectsNLP projectsFlask projects at machinelearningprojects.net

Exit mobile version