ConnectorTypeSCP
class connector_types.connector_type_scp.ConnectorTypeSCP
Copy a file from a SCP remote host to Cloudomation Engine or vice-versa.
This connector type uses SCP to copy a single file from a remote host to Cloudomation Engine or to copy a sigle file from Cloudomation Engine to a remote host.
You can also use this connector as an SFTP connector with limited functionality (only for file transfer, not listing or manipulating directories), as they both use port 22.
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
Options: -
host
The remote hostname or IP address.
Type:
string
-
hostkey
The public key of host.
Type:
anyOf
Options: -
port
Type:
anyOf
Options: -
mode
Type:
anyOf
Options: -
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')