banty01

Using Amazon S3 File Storage

Blog Post created by banty01 Employee on Sep 6, 2016

Connecting your Live API Creator to Amazon S3 (File Storage)

 

I have been working with a partner that had a specific need to extract the contents of a Microsoft Excel spreadsheet into a database.  They will be using Live API Creator running on Amazon (AWS) using Elastic Beanstalk (EBS).  The setup is documented here - but the key was to add the correct Amazon JAR files to the installation (.ebsextensions/JDBCDrivers.config) shown below.  The second part is to create a Java Class and library (see their samples ) that you will load as a user library (JAR) in Live API Creator.  Using a rule or event, you can call the new Java wrapper function.  The trick is to either pass in the accessKey and secretKey (replace their sample code with new BasicAWSCredentials(accessKey,secretAccessKey) );  The other trick is to make sure you have set the access rights for each file you plan to read to allow this user read privileges.

 

var ReadFileFromS3 = Java.type("com.mycompany.s3.ReadFileFromS3");

var myFile =new ReadFileFromS3(buckeName, key, accessKey, secretAccessKey);

 

Sample JDBCDrivers.config for Amazon S3

  "/usr/share/tomcat8/lib/aws-java-sdk-core-1.11.9.jar":

     mode: "000755"

     owner: tomcat

     group: tomcat

     source: http://central.maven.org/maven2/com/amazonaws/aws-java-sdk-core/1.11.9/aws-java-sdk-core-1.11.9.jar

 

  "/usr/share/tomcat8/lib/aws-java-sdk-kms-1.11.9.jar":

     mode: "000755"

     owner: tomcat

     group: tomcat

     source: http://central.maven.org/maven2/com/amazonaws/aws-java-sdk-kms/1.11.9/aws-java-sdk-kms-1.11.9.jar

 

  "/usr/share/tomcat8/lib/aws-java-sdk-s3-1.11.9.jar":

     mode: "000755"

     owner: tomcat

     group: tomcat

     source: http://central.maven.org/maven2/com/amazonaws/aws-java-sdk-s3/1.11.9/aws-java-sdk-s3-1.11.9.jar

 

  "/usr/share/tomcat8/lib/joda-time-2.9.4.jar":

     mode: "000755"

     owner: tomcat

     group: tomcat

     source: http://central.maven.org/maven2/joda-time/joda-time/2.9.4/joda-time-2.9.4.jar

Outcomes