automategreen / particle-lambda-dynamodb-example

This is a quick example of how to set up an AWS Lambda to save data from you particle events in DynamoDB

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This is a quick example of how to set up an AWS Lambda to save data from you particle events in DynamoDB.

We'll be using Node.js and Serverless

1. Install

# Install Serverless
npm install serverless -g

# Install packages
npm install

2. Set AWS credentials

export AWS_ACCESS_KEY_ID="Your AWS Access Key ID"
export AWS_SECRET_ACCESS_KEY="Your AWS Secret Access Key"
export AWS_REGION="us-east-1"

3. Create particle-event table

We're using Dynamoose to simplify our DynamoDB setup.

node Event.js

4. Deploy Lambda and API GW

Use serverless to deploy to your AWS account. Copy the URL returned by serverless for use in the webhook.

serverless deploy

5. Setup your webhook in particle

Webhook

6. Done

It should be working now. You'll probably want to add some API keys for security too.

About

This is a quick example of how to set up an AWS Lambda to save data from you particle events in DynamoDB

License:MIT License


Languages

Language:JavaScript 100.0%