Recipes

Data movement

Transfer an SFTP file to S3

Download a file over SFTP into the isolated run directory and upload it to an S3-compatible bucket.

Supported platforms

LinuxmacOSWindows

Prerequisites

  • SSH key authentication and known-host verification
  • An S3-compatible bucket
  • S3 credentials exposed through environment-backed Dagu secrets

Workflow YAML

description: Download one SFTP file and upload it to S3.
schedule: "0 * * * *"

params:
  - name: host
    default: files.example.com
  - name: user
    default: ingest
  - name: key
    default: ~/.ssh/id_ed25519
  - name: remote_file
    default: /exports/latest.csv
  - name: bucket
    required: true
  - name: object_key
    default: incoming/latest.csv

secrets:
  - name: AWS_ACCESS_KEY_ID
    provider: env
    key: AWS_ACCESS_KEY_ID
  - name: AWS_SECRET_ACCESS_KEY
    provider: env
    key: AWS_SECRET_ACCESS_KEY

steps:
  - id: download
    action: sftp.download
    with:
      host: ${params.host}
      user: ${params.user}
      key: ${params.key}
      source: ${params.remote_file}
      destination: ${context.paths.work_dir}/incoming.dat

  - id: upload
    depends: [download]
    action: s3.upload
    with:
      bucket: ${params.bucket}
      key: ${params.object_key}
      source: ${context.paths.work_dir}/incoming.dat

Review before running

Replace example values, configure the listed secrets, and review every command for your environment. Syntax validation does not make a community workflow trusted.

Running this workflow with a team?

The Team plan adds SSO, role-based access, audit logs, incident routing, and priority support for three self-hosted Dagu servers. Start a 14-day trial without a credit card.

Start Team trial
View sourceInstall DaguContributed by @dagucloud · validated with Dagu 2.13.0

Related Recipes