Steps to script SG (Flow) AMI to see local network files

Hi,
What would be the steps to script an SG ami to do things with our local files?

SG ami on Version page to select versions, on click to move files.

for example: moving mov files from one location to another
\project\abc\shot\999\test.mov to
\project\abc\edit\review

If I am not clear, please let me know.

Thank you for your time.

Hey @unicorn,

AMIs will trigger your own scripts running on your own server. In order for your script to manipulate files on your network, it would need direct access to that network.

In other words, if you have your AMI endpoint server running in the cloud (hosted by AWS, for example), they will not have access to your local network and will not be able to manipulate files.

If your AMI endpoint server is running in-house and is connected to your network, then you can access and manipulate network files through your custom code.

Let me know if that makes sense.

1 Like

Thx Stavernia,
I plan to setup the AMI endpoint in-house, but move files from AWS to local disc.

Do you know how to get this to work?

Depending on the language or setup you have, you can use language tools (python, javascript, etc.) to pull files from the AWS url to local disc. That would be the simplest method.

For example, with python: How to Download Files From URLs With Python – Real Python

So you would create an AMI on SG that would trigger a script running on your local server. Remember that anyone that triggers the AMI will need access to your script server, so if the server is in your office, users will either need to be in your office (or connected through VPN) with access to the local IP address of the server, or the server will need to be set up to be accessible from the web (with a public-facing IP / domain name).

That script would then process the POST data from the AMI and, I assume, find the proper source URLs of files on AWS, find the local folders where the files would go, and transfer those files.

On top of all this, you can set up the AMI to display a modal with information: perhaps transfer options and a download button, perhaps a progress bar or a loading overlay, and perhaps a success notification.

Here’s some more information on AMI setup:

1 Like