Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

SSH + file transfer to remote linux server

Gayatree
6 - Meteoroid

Hi,

 

I have to transfer files to a remote Linux server. There were some threads about the Download tool, but it seems to require a URL field within the file(?) Our files won't have that. Is there a way we could simply ssh into the server and run a remote scp command?

 

Thanks,

Gayatree

5 REPLIES 5
MichalM
Alteryx
Alteryx

@Gayatree 

 

You can leverage the Run Command tool to achieve this. Use Alteryx to create a .bat file dynamically which then calls a third party executable such as plink.exe to ssh into the Linux server and copy the file across.

Gayatree
6 - Meteoroid

@MichalM ,

Thank you! Will look into this. Do you have any examples I could peruse in the meantime?

MichalM
Alteryx
Alteryx

@Gayatree 

 

I've attached an example. Here're the logical steps you need to follow

 

1. Save the file you would like to upload in a location that you can reference downstream in your workflow.

 

I use a combination of the Formula tool and the dynamic output functionality of the Output data tool to achieve this

 

- Use the Formula tool to define the output path

 

dynamicpath.png

 

- Use this to overwrite the output path and remove the field from the output file in the process

 

dynamicoutput.png

 

 

2. Generate your SCP script (in case it needs to be dynamic)

 

I use a batch macro to do this because I want to make sure that the script is written before I try to use it in my plink command.

 

- I use the Summarise tool and Group by the output path to get a single row with the path. I then pass it into the macro through the Control parameter

- I then use this to update a value in my script - the placeholder is entered as a header of a Text Input tool

 

scp FILEPATH michalm@servername.alteryx.com://remote/directory

 

txtinput.png

 

scpupdate.png

 

- Once updated, I save the file as scp.txt which is then referenced as the command file for the plink command

- I use the Append fields tool to create a dependency - making sure that the scp command is updated before I pass the plink command out of the macro. You can download plink.exe from here.

 

c:\commands\plink.exe  -ssh servername.alteryx.com -l michalm -pw @lteryx -m  c:\commands\scp.txt

 

3. Save the plink command as a .bat file and execute it using the Run Command tool 

 

- The Output configuration of the Run Command tool allows you to save the data flowing into the tool (plink command in our case) as a .bat file. 

- The Command portion is used to reference the .bat file which is created on the fly as defined above

 

runcommandbat.png

 

I hope it makes sense.

 

 

 

 

 

 

Aditia
6 - Meteoroid

Hi @MichalM ,

 

I am trying same. I just want to copy a file from remote server and write it on snowflake/tableau. I see in your design flow you have used many extra things. Is there any element which just ssh and copy. Also I tried to implement your flow. however I am seeing can't access folder and nowhere I am providing authentication to ssh the server. 

 

Can you please help me???

Aditia
6 - Meteoroid

@MichalM Any luck??

Labels