Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Remote storage services allow our partners to store and retrieve any amount of data, at any time. Integrating a remote storage service to one of your projects will allow our cloud to write the data we receive to your remote storage. Bluzone aims to integrate with several leading providers. At this time, Bluzone supports Amazon Simple Storage Service (S3). Integrating a S3 bucket into our project is extremely straightforward. The following tutorial describes how to integrate a S3 bucket into your project through the Bluzone Portal.

Amazon Simple Storage Service (S3)

The following steps outline how to configure a Bluzone project to archive data to a S3 bucket. 

  1. Generate IAM credentials for connecting to Amazon S3. Refer to the Setting up for Amazon Simple Storage Service for step-by-step instructions.
    1. Select IAM Management Console
    2. Select a user
    3. Select "Security Credentials" tab
    4. Click "Create Access Key"
    5. Take note of the "Access Key ID" and the "Secret Key" values, as they are needed for a later step
  2. Create a S3 bucket.
    1. From the Amazon S3 Console click "Create bucket"
    2. Give the bucket a name (remember the name, it will be used later)
    3. Select a Region
    4. Click "Create"
  3. Add the S3 bucket to Bluzone.
    1. Login to the Bluzone Portal
    2. Open the project setting view
    3. Select "Remote Storage"
    4. Create a new configuration by clicking "Create"
    5. Enter the following values:
      1. Storage Provider (Currently, only AWS is supported)
      2. S3 bucket name (This should match the name that you assigned to your bucket through Amazon)
      3. Storage Region (Make sure to enter a region that Amazon supports)
      4. AWS Access Key
      5. AWS Secret Key
    6. Click "Save"
    7. Once you have successfully create a remote storage configuration, it will show up in the stream list with the Enabled status. If you choose to disabled a configuration:
      1. Select the configuration from the grid

      2. Uncheck the "Enable this remote storage" box

      3. Click "Save"

The Bluzone app will take a few minutes to setup the remote storage. Once it's finished, our cloud will begin writing data to your bucket.

Data Processing

The data stored in the S3 bucket is in Protocol Buffer format (https://developers.google.com/protocol-buffers/). Here is the "protobuf" file that can be used to generate stub code for parsing the message structure: beaconmetrics.proto (more information regarding the syntax of the .proto file can be found here).

To generate the classes you'll need to read BeaconMetrics messages you need to install the protocol buffer compiler, protoc. See here for detailed installation instructions: https://github.com/google/protobuf, e.g.

Code Block
languagebash
titleInstall protoc
wget https://github.com/google/protobuf/releases/download/v3.4.0/protoc-3.4.0-osx-x86_64.zip ~/Downloads
mkdir -p ~/Downloads/protoc 
cd $_ 
unzip ~/Downloads/protoc-3.4.0-osx-x86_64.zip cp bin/protoc /usr/local/bin 
rm -fR ~/Downloads/protoc-3.4.0-osx-x86_64.zip ~/Downloads/protoc

To create a Java class from the proto file run the following command. A Java class will be created, e.g. Beaconmetrics.java.

Code Block
languagebash
protoc -I=$SRC_DIR --java_out=$DST_DIR $SRC_DIR/beaconmetrics.proto

Once you have the Java class you can begin parsing BeaconMetric files stored in Protocol Buffer Format. For example,

Code Block
languagejava
BeaconMetrics.BeaconRawMetricMap beaconRawMetricMap = BeaconMetrics.BeaconRawMetricMap.parseFrom(new FileInputStream("<FILE_PATH>");
beaconRawMetricMap.getResultsMap();

Alternatively, you can use protoc to parse the data. For example,

Code Block
languagebash
protoc --decode_raw < ~/Downloads/2017-09-29.proto.gz

For a detailed tutorial in Protocol Buffers go here.