Skip to content

S3ToSFTPOperator, SFTPToS3Operator: Support sftp_remote_host Argument #57891

@brettpalmberg

Description

@brettpalmberg

Description

Support new parameter sftp_remote_host in S3ToSFTPOperator and SFTPToS3Operator.

This parameter, if provided, would override remote_host stored in sftp_conn_id.

This would work the same as the remote_host parameter in SFTPOperator

Use case/motivation

This would allow storing credentials/SSH Key in a single connection. If the connection is used with multiple target hosts, remote_host could be overridden in S3ToSFTPOerator().

Example:

for h in ['host1.mydomain.com', 'host2.mydomain.com', 'host3.mydomain.com']:
    create_s3_to_sftp_job = S3ToSFTPOperator(
        task_id="create_s3_to_sftp_job",
        sftp_conn_id='sftp_conn',
        sftp_remote_host=h,
        sftp_path="/sftp_data",
        s3_bucket='my_s3_bucket',
        s3_key='/myfiles/file.txt',
    )

Related issues

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions