Skip to main content
Version: 10 - Vanillekipferl

ConnectorTypeSFTP

class connector_types.connector_type_sftp.ConnectorTypeSFTP

Copy a file from an SFTP remote host to Cloudomation Engine or vice-versa.

This connector type uses the SFTP protocol to interact with a remote host.

It supports copying files from a remote host to Cloudomation Engine or vice-versa, listing the contents of a remote host, fetching stats for a file or directory, removing a file or directory, copying a directory from a remote host to Cloudomation Engine or vice-versa, renaming a file or directory, creating a directory.

note

The SFTP protocol should not be confused with FTP. While similar in names, SFTP and FTP use different protocols and offer different ways of transferring files. If you want to use the FTP protocol, refer to ConnectorTypeFTP

For more on the differences between SFTP and FTP refer to Difference between FTP and SFTP

Input Schema

  • schema_version

    Type: string

  • authentication

    Type: anyOf

  • host

    The remote hostname or IP address.

    Type: string

  • hostkey

    The public key of host.

    Type: anyOf

  • port

    Type: anyOf

  • mode

    Type: anyOf

  • connect_timeout

    A timeout for connecting to a peer in seconds.

    Type: integer

    Default: 30

Output Schema

  • result

    Data

Example

SSH key authentication and copying a file from a remote host to Cloudomation Engine

import flow_api

def handler(system: flow_api.System, this: flow_api.Execution, inputs: dict):
this.connect(
connector_type='SCP',
authentication={
'authentication_method': 'ssh_key',
'username': '...',
'ssh_key': '...',
},
host='...',
hostkey={
'hostkey_mode': 'known_host',
'known_host': '...',
},
mode={
'mode_name': 'copy_file_to_engine',
'source_file_name': '...',
'destination_file_name': '...',
},
)
return this.success('all done')

Username and password authentication and copying a file from Cloudomation Engine to a remote host

import flow_api

def handler(system: flow_api.System, this: flow_api.Execution, inputs: dict):
this.connect(
connector_type='SCP',
authentication={
'authentication_method': 'username_password',
'username': '...',
'password': '...',
},
host='...',
port={
'port_mode': 'port_number',
'port_number': 2022, # non-standard port
},
hostkey={
'hostkey_mode': 'known_host',
'known_host': '...',
},
mode={
'mode_name': 'copy_file_from_engine',
'source_file_name': '...',
'destination_file_name': '...',
},
)
return this.success('all done')