Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

2rn

Using Python & WinSCP to load files to Amazon EC2

Hi,
I am writing a Python 2.7 code to perform tasks with files on AWS EC2 instances, such as:

  • load file from local Windows PC to EC2 folder
  • open new directories on EC2
  • copy files from EC2 folder to another EC2 folder

I already have WinSCP installed and I set up saved connections to all of the EC2 servers I intend to work with. Currently I am manually loading the files from my PC to EC2, and running Linux commands via PuTTY. So I just want to automate the process.

I am new to Python, WinSCP and coding in general, but from what I gather WinSCP can be accessed grammatically, via Python, and do some or maybe even all of the tasks listed above (btw i use boto to load to S3 but with EC2 Boto have no such options).

Important to mention that I use .ppk instead of password when connecting to EC2.

I saw the guides in this site (https://winscp.net/eng/docs/scripts) and googled around quite a bit, but couldn't get it work right.

Would much appreciate if someone could point me to the right path.
Cheers :)