Integrating with AWS Lambda and API Gateway

Hey guys, I wanted to share my tutorial on how to integrate Lambda and the Particle Photon APIs

and here’s the video showing how to create an API in API Gateway


Thank you for sharing!

1 Like

This is a great video, can you demo how a photon call an AWS API that runs a Lambda function?

The way that is done is in a webhook. The second video is about creating an API to run the Lambda function.
You would then create an integration in the Particle console and pass the parameters you set up in the API as form data from your Particle.

It is important to note the step of creating the node_modules folder. Since that folder is a bunch of dependencies required for the lambda function to run, it doesn’t work without that. It did not go for me as in the video.
It was necessary to start a node.js command prompt, then navigate to the same folder as index.js. When I typed npm init, a lot of options were presented which I just accepted by pressing enter for each one. After that you can type npm install apk-particle-js and it will create the node_modules folder. There is additional info on it here,

Thanks for the feedback. It is important to always run “npm init”, or “npm install” if downloading a project, which will create the node modules folder. Nice catch :slight_smile:

Great tutorial, btw, thanks. I got it up and running. It’s like having your own Particle API.

Hope you take over the world with the info! Just wish I was more ambitious at the moment. I’m currently traveling the globe and trying to find my own definition of happiness - still coding here and there and working of course but the tutorials are kinda at an all time low. My main advice is to stick to AWS. It’s definitely the greatest asset in my life

1 Like

Authentication Question: I just completed integration between a Particle webhook and an AWS API Gateway deployed API. I ended up going with no authentication for now. Does Particle support an AWS Signature? Does AWS support Basic authentication?