Use Case: User has a CSV file that they want to drop in an S3 Bucket, and have the data in the file published to MQTT.


Installation

Download the .zip file attached to this article


Create a new Lambda Function


Upload the Zip file and set the environmental variables

There are two environmental variable that need to be set: 

  • COMPLETE_BUCKET - this is the name of the S3 bucket that you want the CSV files to be moved to once they have been successfully processed.
  • TOPIC - this is the topic that you want the data to be published on. the last part of the topic in the brackets (i.e. '[]'), is a list of potential column headers that would provide the unique identifier for a specific device.




Configure the S3 Bucket


We need to create a "hot" folder (i.e. "bucket"), that will process any file that is added to the bucket. 

  • click on any bucket and click the "properties" tab.

  • The click the "Events" tile
  • the click the Add Notifications. Set the "suffix" to "csv" and
    send to = "lambda Function" and the find the lambda function that you just created