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)
- 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
- Include the following namespaces in the class:
- 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.)
- 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.)
- 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.)
- Optionally, you can check for the existence of the file and provide a warning about overwrite (otherwise, files can get overwritten by default).
- Transfer the file to S3 as shown below:
- 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.
Using the Plugin in Logi Application
- 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
- Pass the parameters to the plugin as shown below (these were the parameters accessed in the code example in Step 4 above).
- awsAccessKeyID and awsSecretAccessKey are required to authenticate and process the S3 request
- as shown in this example, with an adjusted S3 bucket policy the same code can export to S3 without awsAccessKeyID and awsSecretAccessKey