All Collections
Tools
Data Forwards
Example: Receiving Data Forwards in AWS DynamoDB via AWS Lambda with Python
Example: Receiving Data Forwards in AWS DynamoDB via AWS Lambda with Python
In this guide you will learn how to receive Senseware's Data Forwards in AWS DynamoDB
Julien Stamatakis avatar
Written by Julien Stamatakis
Updated over a week ago

In this guide we will go through the process of receiving Senseware Data Forwards in AWS. Specifically we will put each data packet published by a Data Forward into Amazon’s DynamoDB. Other AWS storage or data processing solutions like RDS, S3, Kinesis follow the same basic framework. Here are the things we need:

• A database hosted in AWS. For simplicity reasons we will use DynamoDB
• A small script to process the Senseware data forwards and put its data into the database. We will use AWS lamda so we don’t have to worry about managing Servers and EC2 instances
• A HTTP endpoint that we can point the Senseware data forward at. We will use Amazons API Gateway

Step 1: Setting up the database
Log into your AWS Console and select “Amazon DynamoDB”. Next, click on 'Create Table.' Configure the table with table name “senseware” and partition key 'partition'. Wait for the table to be created.

Step 2: Setting up AWS lambda
Now select 'AWS Lamda' in the AWS Services menu, and click 'Get Started'. Create a new function and select the 'microservice-http-endpoint' blueprint. Make sure the security is set to 'Open'.

Next we will set up the processing code. Make sure the function’s runtime is set to 'Python 2.7', and that it has a easily identifiable Name and Role. The code to be pasted can be found here

Now, click 'Next' and then 'Create Function'.

Optional: Testing the function.
If you want to test the new Lamda function, you can simply click on 'Actions', click on 'Configure Test Event' and paste the Example JSON packet found here. Then press 'Save and Test'.

Step 3: Configuring the Senseware Data Stream

You can now see the URL of the HTTP endpoint in the 'Triggers' section of your new Lamda function. Copy this URL to the URL section of the Senseware data stream settings page:

Your DynamoDB will now begin to receive data:

Did this answer your question?