I'm trying to get a file from SFTP and upload it to an s3 bucket using paramiko (and python)
def get_file(host, port, username, password, output,filepath):
transport = paramiko.Transport((host, port))
transport.connect(username=username, password=password)
sftp = paramiko.SFTPClient.from_transport(transport)
sftp.get(filepath,output)
sftp.close()
return
But I'm getting this error:
with open(localpath, "wb") as fl:
FileNotFoundError: [Errno 2] No such file or directory:
.get needs a local path and not an s3 bucket so how can upload my elements directly to s3 ?