From the Blog

An icon for a calendar

2017-02-10

AIS-Amazon S3 Integration

This video shows how you can use the Adeptia Solution to integrate with Amazon S3 to read, write and delete files.

Steps to implement the data integration with S3 are outlined below the video that you can follow.

You can use the attached custom plugin code to read, write and delete files from Amazon S3.

You can create custom plugins by going Develop –> Services –> Extensions –> Custom Plugin.

You can copy the attached custom plugin code and paste in the “Script” of your Custom Plugin to read, write, and delete files from Amazon S3. These Custom Plugins can then be used in your process flows at the described locations below.

You need to set the following key’s value in context with the given names in the custom plugin code :

API key:amazons3Key

Secret key:secretKey

End Point:endPoint

Bucket Name:bucketName

If the specified bucket does not exist already in Amazon S3, the bucket will be created using the custom plugin for you.

Suppose you need to write a file from any source to Amazon S3 then you can use the attached custom plugin, CP_WriteFileToAmazonS3.txt,after that source and that includes the following code:

// replace the “fileName” with name by which you want to create file on Amazon S3

// inputStream is implicitly available in plugin so you don’t need to anything for it.

amazonFileExchanger.putFileFromStream(“fileName”, inputStream);

In the custom plugin Properties in your process flow, set Consume Stream to true and Generate Stream to false.

AIS-Amazon S3 Integration

Suppose you need to get the file from Amazon S3 and pass to some other activity then you can use the attached custom plugin, CP_ReadFileFromAmazonS3.txt, that includes the following code:

// replace the “fileName” with name of the file that you want to read from Amazon S3

// service object is implicitly available in custom plugin and getOutputStream() will give you the output stream.

amazonFileExchanger.getFileToStream(“fileName”, service.getOutputStream());

In the custom plugin Properties in your process flow, set Consume Stream to false and Generate Stream to true.

AIS-Amazon S3 Integration

If you need to delete any file Amazon S3 then you can use the attached custom plugin, CP_DeleteFileFromAmazonS3.txt, includes the following code:

// replace the “fileName” with name of file that you want to delete

amazonFileExchanger.deleteFile(“fileName”);

In the custom plugin Properties in your process flow, set both Consume Stream and Generate Stream to false.

AIS-Amazon S3 Integration