All Collections
User Guides
Plugins: Backup your Ubidots data with AWS S3
Plugins: Backup your Ubidots data with AWS S3

Back up your Ubidots account data into AWS S3

Sergio M avatar
Written by Sergio M
Updated over a week ago

Ubidots and AWS have partnered to create a pre-built integration allowing users to easily forward sensor data from Ubidots to AWS S3, using Plugins.

In this tutorial, you will learn how to connect your AWS account to Ubidots by creating a user and a policy with the permissions required for that connection, and to give access to a specific S3 bucket.


Requirements

Table of Contents

1. Retrieve your AWS Access Keys

To retrieve AWS access keys, console you need to create a user, assign it a policy and then create AWS access keys for it. Go to your AWS IAM Management click on the “users” option at the left panel, then on add users, and follow these steps:

  1. Give a name to the user and click on next.

  2. Select Attach policies directly then click on create policy.

  3. Select JSON.

  4. Enter the following JSON replacing <bucket-name> with the name of the bucket Ubidots should have access to in order to forward data and, also replace the <AccountId> field for the Account Id Number find in your profile in AWS.

    {
    "Version": "2012-10-17",
    "Statement": [
    {
    "Sid": "VisualEditor0",
    "Effect": "Allow",
    "Action": [
    "iam:GetRole",
    "iam:CreateRole",
    "iam:PutRolePolicy",
    "iam:ListRolePolicies"
    ],
    "Resource": "arn:aws:iam::<AccountId>:role/Ubidots*"
    },
    {
    "Sid": "ListObjectsInBucket",
    "Effect": "Allow",
    "Action": [
    "s3:ListBucket"
    ],
    "Resource": [
    "arn:aws:s3:::<bucket-name>"
    ]
    },
    {
    "Sid": "AllObjectActions",
    "Effect": "Allow",
    "Action": "s3:*Object",
    "Resource": [
    "arn:aws:s3:::<bucket-name>/*"
    ]
    }
    ]
    }

  5. Click on next and then on review

  6. Enter a name for the policy and click on create policy

  7. Go back to the user creation tab and refresh the list of policies tab.

  8. Select the policy created on the 6th step and click on create user

  9. Once the user gets created, scroll down to "access keys" and click on create access key

  10. Select third-party service, click on the checkbox that will open at the bottom,

  11. Click next and then on create access key.

  12. Copy the “Access key ID” and the “Secret access key” which will be used later to complete the AWS Plugin on the Ubidots platform. You can also download the keys with the Download .csv button.

2. Creating an AWS S3 Backup Plugin

Step 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 S3 Backup, click on it and follow the on-screen steps:

Step 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 set up 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.

Step 3: After successful authentication, the plugin configuration options will appear:

  • Backup data from: This drop-down defines the source of the backup data. Possible options are: Devices, Organizations, Device Groups, and Device Types. The Devices option will backup data from all devices. The last three options backup data from one single entity.

  • AWS Region: The AWS region where you currently use AWS S3 storage, or plan to.

  • S3 Bucket Name: Your S3 bucket from your AWS Account. Please note: The bucket has to exist in your AWS account and the connected AWS account has to have permissions to access this S3 bucket, otherwise the plugin will fail.

  • Upload Path: The path in the S3 bucket to which the backup will be uploaded to. Please note: The Upload Path cannot start or end with a "/".

  • Date range: The time range of the data that is backed up and uploaded to S3.

  • Backup every: The frequency of the backup.

  • On: The day or day of month at which the backup is executed.

  • At: The time when the backup is executed.

  • Timezone: The timezone of the "At" field.

  • Ubidots Token: Select the Ubidots token you'd like to use for this plugin.

Ubidots will not create any resource in your AWS account. The plugin uploads a csv file to the specified location defined by the S3 bucket name and the upload path. Costs may arise due to the data transmission.

Step 4: Finish the process and a new plugin will appear in the Plugins list.

The plugin regularly collects and compiles the data from the selected Ubidots data entities into a csv file. This csv file is then uploaded to the upload path in the defined S3 bucket in your AWS Account.

3. Editing the Plugin's

To edit the Plugin, simply click on the Edit button in the Plugins list view:

The same "Input" fields that appeared during the creation process will appear. Please note that, every time the Plugin is updated, a provisioning script will run, overriding the current attributes.


4. Plugin costs

This plugin consumes dots out each time a backup is made. To learn how the data extraction is billed, please refer here.

5. Feedback and suggestions

Feel free to post questions or suggestions in our community portal, or drop us a line at support@ubidots.com.

Learn more about other plugins:

Did this answer your question?