AWS Switch Scripting Project

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

AWS Switch Scripting Project

Post by gabrielp » Tue Dec 23, 2014 4:50 am

I'd really like to get a solid collection of Amazon Web Services (AWS) scripts that work with Switch. Imagine being able to store files easily into S3, build queue-centric workflows with SQS, or response to events in Switch with a decoupled compute service like Lambda.

My original plan was to wait until I got my hands on Switch 12 Update 3's new HTTP class. But as soon as I had access to it, I realized that reinventing a RESTful wheel Amazon has already made with their SDK would be a fool's errand. So instead, after a bit of thought, I've decided to write each method in Node.js as a command line utility. Then, Switch will then simply pass arguments into a Process.execute() to invoke Node. So, a base requirement is having Node.js installed.

I already have one Script working: S3 Upload. It takes an input file and uploads it to an S3 bucket of your choosing, returning the URL on S3. I need to add some ACL settings so you can choose whether or not you want it to be public-read.

If this interests any of you, I'd love it if you joined the repo and pitched in. This could be a great tool for all of us.

Here is my repo: https://github.com/dominickp/SwitchAWS

Questions, comments, complaints? Looking forward to discussing this.
Last edited by gabrielp on Wed Aug 12, 2015 4:26 pm, edited 1 time in total.
Free Switch scripts: open-automation @ GitHub
Free Switch apps: open-automation @ Enfocus appstore

If I've helped you and you'd like to say thanks, consider adding me on LinkedIn and leaving me an endorsement or recommendation. It helps a lot!

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

AWS Switch Scripting Project

Post by gabrielp » Thu Dec 25, 2014 5:17 pm

After giving this some thought, I'm not sure what I was thinking making a CLI in Node. I think I wanted to take advantage of the AWS-SDK hoping I could do work to the request/files somehow, but if I continue with this model of invoking a CLI then I can do lots of that within the Switch script... So I don't see the point in re-making the CLI in Node since AWS CLI is really good already available. I'll make an update soon to update the S3 Upload configurator I already made.
Free Switch scripts: open-automation @ GitHub
Free Switch apps: open-automation @ Enfocus appstore

If I've helped you and you'd like to say thanks, consider adding me on LinkedIn and leaving me an endorsement or recommendation. It helps a lot!

ArielRauch
Advanced member
Posts: 231
Joined: Thu Aug 07, 2014 10:04 am

AWS Switch Scripting Project

Post by ArielRauch » Fri Dec 26, 2014 9:25 am

I am quite curious to see your progress.

Probably the only one these days:)

dkelly
TOP CONTRIBUTOR
Posts: 650
Joined: Mon Nov 29, 2010 8:45 pm
Location: Alpharetta GA USA
Contact:

AWS Switch Scripting Project

Post by dkelly » Fri Dec 26, 2014 6:13 pm

Should we create issues for each of the features that folks want to implement? That way we can track status & assignments, avoid duplicate effort, etla.

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

AWS Switch Scripting Project

Post by gabrielp » Sun Dec 28, 2014 12:34 am

ArielRauch wrote: I am quite curious to see your progress.
Make sure to click "Watch" on the repo!



dkelly wrote: Should we create issues for each of the features that folks want to implement? That way we can track status & assignments, avoid duplicate effort, etla.


That's a great idea. I will put in some issues of ideas I have in the works.
Free Switch scripts: open-automation @ GitHub
Free Switch apps: open-automation @ Enfocus appstore

If I've helped you and you'd like to say thanks, consider adding me on LinkedIn and leaving me an endorsement or recommendation. It helps a lot!

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

AWS Switch Scripting Project

Post by gabrielp » Sun Dec 28, 2014 12:40 am

Is everyone cool with the MIT license? https://github.com/dominickp/SwitchAWS/ ... er/LICENSE
Free Switch scripts: open-automation @ GitHub
Free Switch apps: open-automation @ Enfocus appstore

If I've helped you and you'd like to say thanks, consider adding me on LinkedIn and leaving me an endorsement or recommendation. It helps a lot!

jugganaut
Member
Posts: 39
Joined: Wed May 08, 2013 6:48 pm

Re: AWS Switch Scripting Project

Post by jugganaut » Tue Feb 24, 2015 4:57 pm

@gabrielp - this sounds pretty interesting. Just wondering what sort of uses you envisioned this connection to have?

Also, another service that you might check out that I've just recently finished an API project with is DreamFactory - it's an open source API framework of sorts that you can connect to any database type.

tz8
Member
Posts: 84
Joined: Mon Aug 13, 2012 12:56 pm

Re: AWS Switch Scripting Project

Post by tz8 » Fri Apr 24, 2015 1:54 pm

for you mac guys out there, some nice person actually included awscli in the macports

to install (given that you have macports installed already):

Code: Select all

sudo port selfupdate
sudo port install py27-awscli py27-pip
port select --set pip pip27
sudo -H pip install awscli
then you can work with aws on the command line, try it by opening the help page with:

Code: Select all

/opt/local/bin/aws-2.7 help

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

Re: AWS Switch Scripting Project

Post by gabrielp » Wed Aug 12, 2015 4:17 pm

Hey guys,
We're running into an issue with the S3 Download script: https://github.com/dominickp/SwitchAWS/ ... ownload.js

The issue seems to be that when a timerFired event occurs and the script executes, it opens a process but that process is never released. If I leave the flow on overnight with the timerFired set to two minutes, it eventually hits the process limit on the machine and the only way to clear it out is to restart the machine.

Could someone with timerFired script experience take a quick look at that script and let me know if I forgot anything glaring? Is there something I'm supposed to do to tell Switch to exit the process?
Free Switch scripts: open-automation @ GitHub
Free Switch apps: open-automation @ Enfocus appstore

If I've helped you and you'd like to say thanks, consider adding me on LinkedIn and leaving me an endorsement or recommendation. It helps a lot!

dkelly
TOP CONTRIBUTOR
Posts: 650
Joined: Mon Nov 29, 2010 8:45 pm
Location: Alpharetta GA USA
Contact:

Re: AWS Switch Scripting Project

Post by dkelly » Wed Aug 12, 2015 5:50 pm

Have you been able to determine if the unterminated processes are Switch or AWS scripts?

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

Re: AWS Switch Scripting Project

Post by gabrielp » Wed Aug 12, 2015 6:19 pm

dkelly wrote:Have you been able to determine if the unterminated processes are Switch or AWS scripts?
If you do a ps -A, the processes show up like this:

Code: Select all

10815	??	0:00.00 (SwitchScriptExec)
10830	??	0:00.00 (SwitchScriptExec)
10846	??	0:00.00 (SwitchScriptExec)
So it seems the processes are Switch processes.
Free Switch scripts: open-automation @ GitHub
Free Switch apps: open-automation @ Enfocus appstore

If I've helped you and you'd like to say thanks, consider adding me on LinkedIn and leaving me an endorsement or recommendation. It helps a lot!

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

Re: AWS Switch Scripting Project

Post by gabrielp » Thu Aug 13, 2015 11:57 pm

gabrielp wrote:Hey guys,
The issue seems to be that when a timerFired event occurs and the script executes, it opens a process but that process is never released. If I leave the flow on overnight with the timerFired set to two minutes, it eventually hits the process limit on the machine and the only way to clear it out is to restart the machine.
This is now fixed: https://github.com/dominickp/SwitchAWS/issues/8
Free Switch scripts: open-automation @ GitHub
Free Switch apps: open-automation @ Enfocus appstore

If I've helped you and you'd like to say thanks, consider adding me on LinkedIn and leaving me an endorsement or recommendation. It helps a lot!

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

Re: AWS Switch Scripting Project

Post by gabrielp » Tue Jul 12, 2016 8:27 pm

I've added SES Send, which acts as a drop-in replacement for Switch's "Mail send" configurator. More here: https://github.com/open-automation/SwitchAWS
Free Switch scripts: open-automation @ GitHub
Free Switch apps: open-automation @ Enfocus appstore

If I've helped you and you'd like to say thanks, consider adding me on LinkedIn and leaving me an endorsement or recommendation. It helps a lot!

Post Reply