Simple AWS S3 Example Flow: Sendfile, WeTransfer, Hightail-type service

Post Reply
User avatar
gabrielp
Advanced member
Posts: 645
Joined: Fri Aug 08, 2014 4:31 pm
Location: Boston
Contact:

Simple AWS S3 Example Flow: Sendfile, WeTransfer, Hightail-type service

Post by gabrielp »

Hey guys,
As some of you may know, I'm working on a collection of scripts for Switch to more easily interface with Amazon Web Services. I know cloud solutions have been slow to be adopted by our industry, so I put together a little simple example of how you can make a service like Sendfile, Hightail, or WeTransfer, for your organization for free (or damn close), using on Switch. Hoping that this will demonstrate S3’s simplicity as well as the value of SwitchAWS, and of course, Switch :lol:.

The Problem:
We want a system that will allow any user in our organization to send very large files to other people via email. This system should be able to handle files of around 5-10GB and the files should expire automatically after a certain amount of time so we do not rack up long term storage charges. The user must be able to send a single file, a set of files, or a folder.

Requirements:
Switch Client, Switch Scripting, AWS CLI

Solution:
The user drags the files they want to send into the Switch Client. They are then prompted with this Submit Point metadata screen:
Image
Most of the fields above are optional. They fill out what they want and click submit.

Within a few moments, an email goes out to the recipient(s) specified, with me (as the sender) BCC’d.
Image
And best of all, in 14 days, that file will be removed from the S3 bucket automatically.

Explanation:
You can view the documented flow here:
https://5177154f0ca9401dd7db4b20a02fa27 ... UliZWVncUU
Download the actual flow here:
https://drive.google.com/file/d/0B726GN ... sp=sharing

Once they click submit, the files are compressed. If a single compressed file is sent, it does not get compressed again.
Image
The compressed set of files goes is sent through the S3 Upload configurator which uploads the file into the target S3 bucket; in my case: “hosted-file-send”. Once this is complete, the S3 object URL is appended to the job’s Private Data with the key “S3UploadLocation”. We will use this in our email.
Image
The job passes through a “Mail send” configurator which sends a nicely templated HTML email with a direct link to the S3 object.
Image
To handle automatic file expiration, we will leverage an S3 Lifecycle Rule. We simply click on our bucket (‘hosted-file-send’ in my case) in the AWS S3 console and in the Lifecycle tab, click “Add rule”. We then just set the files to permanently delete after X number of days. I chose 14.
Image
Then, you just give it a name and enable it. I called mine “Delete after 2 weeks”.
Image
Now all objects that are added to this bucket will be automatically deleted 14 days later. Easy, right? I mean, look how simple that flow is. That's all S3's simplicity that allows us to do this so easily.

If you're unfamiliar with S3 pricing, it's dirt cheap for an application like this. I think I calculated that a 5GB file to upload and get downloaded by the recipient and hosting it for a month would cost 42 cents. Well covered by their free tier...

Any questions, comments, improvements? Feel free to chime in.
Free Switch scripts: open-automation @ GitHub
Free Switch apps: open-automation @ Enfocus appstore

Want to hire me? I'm looking for my next gig. Contact me on LinkedIn or via email.
Mark Adams
Newbie
Posts: 1
Joined: Mon Jan 09, 2017 11:41 am

Re: Simple AWS S3 Example Flow: Sendfile, WeTransfer, Hightail-type service

Post by Mark Adams »

Wow, this is incredibly thorough. Thanks for sharing, Gabriel! I'll definitely be referencing this in the future for my cloud related projects.
Zoranj
Member
Posts: 107
Joined: Tue Sep 20, 2016 7:37 pm
Location: Canada

Re: Simple AWS S3 Example Flow: Sendfile, WeTransfer, Hightail-type service

Post by Zoranj »

Gabriel, thanks for sharing this wonderful flow and tutorial.
I've been playing with it all day and I managed to get it going (mostly wasted time on setting up AWS cli on Windows 2008 server, had to do it through Python).
It works fantastic and is exactly how I imagine this service to be.

I will polish it bit more, of course replacing logos and such to personalize it more for us and will try to convince company to use it and ditch old system.

You rock!
User avatar
gabrielp
Advanced member
Posts: 645
Joined: Fri Aug 08, 2014 4:31 pm
Location: Boston
Contact:

Re: Simple AWS S3 Example Flow: Sendfile, WeTransfer, Hightail-type service

Post by gabrielp »

Glad you guys found it helpful! :)
Free Switch scripts: open-automation @ GitHub
Free Switch apps: open-automation @ Enfocus appstore

Want to hire me? I'm looking for my next gig. Contact me on LinkedIn or via email.
Post Reply