Script to locally generate simulated data stream that mimics IoT data from Simple Beer Service (https://github.com/awslabs/simplebeerservice)
Branch: master
Clone or download
Latest commit 9ab98ca May 18, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE.txt Formatting LICENSE May 18, 2017
README.md Update README.md May 16, 2017
sbs.py Added python script and license May 16, 2017

README.md

Sample Data Generator for AWS IoT Simple Beer Service

This is the code repository for sample code to locally generate IoT device data similar to what is generated by the AWS Simple Beer Service devices, and feed it to AWS IoT service.

Pre-requisites

Script Details

The script generates random values (within a reasonable range) for each of the four parameters- Flow, Temperature, Humidity and Sound. You can tweak the values by changing the random.randint(min, max) values corresponding to each parameter.

The script is set to generate messages of each of the four types in a fixed percentage. If you want more or less messages of a particular parameter, you can change the values of rnd in the if...else part of the code.

Running Example

$ python sbs.py

Run the script on Amazon EC2 Instance

If for some reason you are unable to run this script on your local machine, or prefer to host it externally, you can run it from an Amazon EC2 instance. Follow these steps:

  1. Create an IAM role with a policy that gives access to IoT (example: AWSIoTFullAccess)
  2. Launch a new EC2 instance and assign it the IoT IAM role at launch
  3. Login to the EC2 instance and change to root user sudo su
  4. Set your default region and output format in aws configure
  5. Upload sbs.py file to EC2, or nano sbs.py, copy the entire script, save and exit
  6. Make sure you have boto3 installed. If not, type pip install boto3
  7. Run python sbs.py