Upload zip file from Google cloud storage to SFTP server without loading into memory using Python
22:59 03 Aug 2022

I want to upload large zip files from google cloud bucket to SFTP server without loading into memory and cloud function. I am using pysftp for SFTP transfer.

with pysftp.Connection(host="SFTP Server", username='test', password='test', cnopts=cnopts) as sftp:
    sftp.cwd("/tmp")
    sftp.put("zip_file_from_google_bucket")

Can we access os path of the file in the bucket and provide the file path in the sftp.put() since gs:// path will not be recognised in the sftp.put()?

Do we have any other method to transfer?

Please advice.

python google-cloud-storage sftp pysftp