How To Connect and Upload Files To an Amazon S3 Trading Partner
Overview
In this tutorial, we'll show you how to connect JSCAPE MFT Server to an Amazon S3 Trading Partner and then upload files to an S3 bucket.
What we want to accomplish
There are many use cases for this kind of set up but in this particular example, we want JSCAPE MFT Server to detect files as they're added to a local directory and then upload each of those files to an S3 bucket in the Amazon cloud.
Want to watch a video version of this blog post instead?
Things to set up on JSCAPE MFT Server
To accomplish our goal we'll need to set up the following on JSCAPE MFT Server:
- A Directory Monitor that would detect files added to a particular directory;
- An Amazon S3 Trading Partner, which will serve as the final destination of the files detected in # 1; and
- A Trigger that would respond each time files are added to the monitored directory. This same trigger would also be responsible for automatically uploading those files to the Amazon S3 trading partner.
Let's start by creating that directory monitor.
Creating the directory monitor
To create a directory monitor, go to the Directory Monitors module and click the Add button.
Give the directory monitor a name, specify the directory you want to monitor, and set a desired monitor interval.
Because we only want this directory monitor to monitor for newly added files, let's just uncheck all events except the Monitor file add event.
Click the Ok button when you're done.
Our next step is to create that Amazon S3 trading partner
Creating the Amazon S3 Trading Partner
Before you create an Amazon S3 trading partner, of course, you need to make sure you already have an Amazon S3 account along with an S3 bucket. We'll be needing the name of that S3 bucket when we create the trigger.
Once you have your Amazon S3 bucket ready, go to the Trading Partners module and then click the Add button.
Select Amazon S3 from the drop-down list and then clock OK.
Give this trading partner a name and then enter your Amazon S3 Access Key ID (Access Key) and its corresponding Secret Key.
Check whether you can connect to your Amazon S3 account by clicking the Test Server button. If all goes well, click the Ok button.
We're now ready to proceed to the final step. Let's now create the trigger that would upload files to that S3 trading partner.
Creating the file upload trigger
Navigate to the Triggers module and then click the Add button.
Give the trigger a name and then select the Directory Monitor File Added event type. This is the event that will be raised each time a file is added into the monitored directory. Click Next to proceed.
In case you've created other directory monitors that also raise the Directory Monitor File Added event type, specify the directory monitor we created earlier in the trigger conditions box in order to filter out all irrelevant events. Use the following expression:
MonitorName = "Dirmon1"
Click Next to proceed
We now add the trigger action that would ultimately upload each detected file to the S3 bucket.
Click the Add button and select the Trading Partner File Upload trigger action.
As soon as the next screen appears, select the trading partner we created earlier from the drop-down list.
For the Local File field, just enter the %File% variable. The value of this variable corresponds to the path of each newly added file. So, each time a file is added to the monitored directory, the Directory Monitor File Added event type is raised, this trigger responds, and the path of the newly detected file is populated into this Local File field.
Lastly, we just specify the name of the Amazon S3 bucket. Just enter the S3 bucket name into the Remote Directory field.
If you want to upload the files to a specific folder in that bucket, just specify the relative path of that folder. For example, if the folder is named 'folder1', then just enter the path likeso:
Click Ok to finalize the trigger creation process.
That's it. Now you know how to connect and upload files to an Amazon S3 bucket using JSCAPE MFT Server.
Related content
Updated Video: Using Directory Monitors
Setting Up a NAS Shared Storage for Your File Transfer Servers
How To Install A SFTP Server on Windows
Key points to remember when connecting and transferring files with an Amazon S3 trading partner
Get started
Want to try this out? Request a free trial of JSCAPE MFT Server by clicking the image below.