How to build and use an AWS S3 Export plugin within your Logi Analytics application

Enabling a direct export to a Secure, Scalable and Reliable AWS S3 storage will make your Logi Analytics application even more powerful. Contents stored in an S3 bucket can beĀ secured with different security option like bucket policies and permissions to make itĀ available to individuals or group of people or to the entire internet. S3 guarantees 11 9’s durability and 99.99% availability with virtually unlimited storage.

This blog will walk you through 9 easy steps to build an AWS S3 export plugin and use it within aĀ Logi Analytics application.Ā  You first need to create and build the Export to S3 Plugin (a dll), and then call this plugin within your Logi Analytics application with all the required parameters. Our example shows how to create and use a .NET dll to check for an existing file and copy files to AWS S3. (Note that our example uses C#.NET, however the same plugin can be built in Java).

CreatingĀ the Plugin (dll)

  1. Add the reference for the rdPlugin.dll, which is located in the Logi application folder \bin directory. and the following AWS DLL references are required
    • AWSSDK.Core
    • AWSSDK.S3

    AWS S3 Plugin for Logi Analytics Application

  2. Include the following namespaces in the class:
    • rdPlugin
    • Amazon
    • Amazon.S3
    • Amazon.S3.Transfer

    AWS S3 Plugin for Logi Analytics Application

  3. Use the sendFileToS3 method, which will be called from the Logi Analytics application. (This method must be public and can have only one ref input parameter of type rdServerObjects.)
    AWS S3 Plugin for Logi Analytics Application

    • Note that any parameters that are added in the Logi plugin call are encapsulated under rdObjects.PluginParameters and can be accessed as shown below (rdObjects, the ref parameter, is passed to the method.)

    AWS S3 Plugin for Logi Analytics Application

  4. Initialize the S3 client and transfer utility as shown below. You need to initialize the S3Client utility with the AccessKeyID, SecretAccessKey, and Region parameters. (These can be null if the proper bucket policy is set or if the appropriate role is set in the EC2 instance.)
    AWS S3 Plugin for Logi Analytics Application
  5. Optionally, you can check for the existence of the file and provide a warning about overwrite (otherwise, files can get overwritten by default).
    AWS S3 Plugin for Logi Analytics Application
  6. Transfer the file to S3 as shown below:
  7. Build the dll with the following namespace and class, and then copy the S3Utility, AWSSDK.S3, and AWSSKD.Core DLLs to the Logi application folder \bin directory.
    AWS S3 Plugin for Logi Analytics ApplicationAWS S3 Plugin for Logi Analytics Application

UsingĀ the PluginĀ in Logi Application

  1. Note the class type name S3Utility.AMZS3Utility (namespace.classname)You are now all set to use the plugin in the Logi app. Calling the plugin method sendFiletoS3 from a task is as simple as this
    AWS S3 Plugin for Logi Analytics Application
  2. Pass the parameters to the plugin as shown below (these were the parameters accessed in the code example in Step 4 above).
    1. awsAccessKeyID and awsSecretAccessKey are requiredĀ to authenticate and process the S3 request
    2. as shown in this example, with an adjusted S3 bucketĀ policy the same code canĀ export to S3 without awsAccessKeyID and awsSecretAccessKey
      AWS S3 Plugin for Logi Analytics Application

 

Stay in Touch

Get the latest news, posts, and in-depth articles from dbSeer in your inbox.

"*" indicates required fields

This field is for validation purposes and should be left unchanged.