Ubidots and AWS have partnered to create a pre-built integration allowing users to easily forward sensor data from AWS IoT Core to Ubidots, using Plugins.
This integration will automatically create the following resources in your AWS account:
Table of Contents
1. Creating a Policy
To Create a Policy, go to your AWS IAM Management console, then click on the Policies option in the left panel, and follow these steps:
Click on the Create Policy button.
Select the JSON tab and paste the following code. You will need to replace the
<NumberAccountUser>field for your Account ID Number found in your profile. Move to the next page.
Leave the tags section as it is and move to the review page.
In the Review policy page only fill out the Name field, assign a name to identify your new created policy and click on the Create policy.
2. Retrieve your AWS Access Keys
To retrieve your AWS Access Keys, go to your AWS IAM Management console, then click on the “Users” option at the left panel, and follow these steps:
Click on the "Add user" button.
Enter a name for the user, Select the option “Programmatic Access” and move to next page.
Click on the option "Attach existing policies directly". Look for the policy created in the previous step and select it.
Skip the tags page and move to next page.
Click on the "Create user" button.
Copy the “Access key ID” and the “Secret access key” which will be used later to complete the AWS Plugin on Ubidots platform. You can also download the keys with the Download .csv button.
3. Creating an AWS IoT Core Plugin
The AWS IoT Core Plugin is a serverless function that exposes a private HTTPS Endpoint URL optimized to decode AWS HTTPS Rule JSON payloads. Every time an HTTP POST request is received at such URL, a pre-defined decoding function will be executed.
To create a plugin:
1. In your Ubidots account, go to the "Devices" tab, click on "Plugins", then click on the "+" icon to create a new Plugin. Search for the AWS IoT Core Plugin, click on it and follow the on-screen steps:
2. An authentication window will appear. Enter your AWS Access Key ID and Secret Access Key created earlier in this guide. By entering your AWS Access Keys, Ubidots will automatically setup the required resources in AWS to complete the integration.
IMPORTANT NOTE: As a security measure, Ubidots does NOT store any AWS Access Key IDs or Secret Keys. The permission with Access Keys is used only once at the beginning of a Plugin's setup to create a restricted role in AWS and securely setup AWS resources to stream data to Ubidots. If you’d rather not provide your AWS keys, an advanced integration can be setup using AWS IAM Role and this user guide.
3. After successful authentication, the plugin configuration options will appear:
AWS Region: The AWS region where you currently use AWS IoT Core, or plan to. Ubidots will create the AWS IoT Rule and HTTPS Destination in this region.
Associated device type: An Ubidots device type will be created and linked to this plugin. Editing the device type allows you to make batch changes to all devices that receive data through this plugin.
AWS IoT Rule Query Statement: The query statement applied by the AWS IoT Rule before forwarding any data to this plugin. See AWS IoT SQL Reference.
Ubidots token: Select the Ubidots token you'd like to use for this plugin. We recommend creating a new token dedicated to this plugin only, should you need to increase its rate limit in the future.
Ubidots will create an HTTPS AWS IoT rule action pointing to this plugin. This may take up to 3 minutes. You can check the progress in your AWS account by going to the "Destinations" option within the "Act" section of AWS IoT.
NOTE: You should see a new destination. At first, it will appear as "Disabled" while a verification process is done by AWS. After a few minutes, it will become "Enabled".
4. Finish the process and a new plugin will appear in the Plugins list.
4. Decoding your custom payloads
To edit the decoding function, click con the created plugin and go to "Decoder". By default, this plugin is pre-configured to grab data from the topic:
Where "+" is a unique identifier of the device, to be used in Ubidots as the unique device label. If data from an unknown device label is received, then Ubidots will automatically create a new device upon reception of the first datapoints.
The default expected data format is as follows, but of course, you can change it at will using the decoder:
5. Feedback and suggestions
Learn more about other plugins: