Skip to main content
Version: 10 - TBD

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.

note

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

  • hostname

    The hostname or IP to use.

    Type: string

  • port

    Type: anyOf

  • username

    The user name to use.

    Type: string

  • password

    The password to use to authenticate. Either "password" or "key" must be specified.

    Type: anyOf

  • hostkey

    Type: anyOf

  • key

    The SSH private key to use to authenticate. Either "password" or "key" must be specified.

    Type: anyOf

  • src

    The path of the source file to copy. Use the format "cloudomation:<path>" to copy a file from Cloudomation Engine.

    Type: string

  • dst

    The path of the destination file. Use the format "cloudomation:<path>" to copy a file to Cloudomation Engine.

    Type: string

  • connect_timeout

    How long to wait for the SSH connection to be established.

    Type: integer

    Default: 60

  • copy_timeout

    How long to wait for the copy to finish.

    Type: integer

    Default: 60

Output Schema

Constants

ssl_context_inputs = ['check_hostname', 'client_cert', 'client_key', 'server_ca']

Example

import flow_api

def handler(system: flow_api.System, this: flow_api.Execution, inputs: dict):
this.connect(
connector_type='SCP',
hostname='my-ssh-server',
hostkey='ssh-rsa AAAAB3NzaC1yc2E...',
username='kevin',
key='-----BEGIN RSA PRIVATE KEY-----\nMII...',
name='copy apache error log from host',
src='/var/log/httpd-error.log',
dst='cloudomation:apache-error.log',
)
error_log_content = system.file('apache-error.log').get_text_content()
auth_failure_count = error_log_content.count('authentication failure')
this.log(f'there are {auth_failure_count} authentication failures')

return this.success('all done')