Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ecsta cp command #61

Merged
merged 12 commits into from
Aug 26, 2024
Merged

Add ecsta cp command #61

merged 12 commits into from
Aug 26, 2024

Conversation

fujiwara
Copy link
Owner

@fujiwara fujiwara commented Aug 24, 2024

This PR adds ecsta cp.

Usage: ecsta cp <src> <dest> [flags]

Copy files from/to a task

Arguments:
  <src>     Source
  <dest>    Destination

Flags:
      --port=12345          port number for file transfer
      --[no-]progress       show progress bar
      --id=STRING           task ID
      --container=STRING    container name
      --family=FAMILY       task definition family name
      --service=SERVICE     ECS service name

Example:

$ ecsta cp /path/to/file.txt _:/tmp/file.txt  # copy file to a task(_ is the selected task)
$ ecsta cp 75dc060ef49b4ba1b2a33581dc5b876f:/tmp/file.txt /path/to/file.txt  # copy file from the task.

ecsta cp copies files from/to a task.

How to work ecsta cp

ecsta cp works as below.

  1. ecsta starts a temporary TCP server on the task vie ECS Exec.
    • The server listens on the specified port (default is 12345).
    • tncl is used as the server. It is a tiny TCP server that like nc -l command.
    • The server is terminated when the file transfer is completed.
  2. ecsta starts a port forwarding to the temporary server.
  3. ecsta connects to the temporary server via the port forwarding.
  4. ecsta sends or receives files via the connection.

Requirements:

  • The task must have the ECS Exec feature enabled.
  • The task must have sh, base64, and chmod commands.

@fujiwara fujiwara changed the title ecsta cp using tncl Add ecsta cp command Aug 26, 2024
@fujiwara fujiwara merged commit 0e502b3 into main Aug 26, 2024
4 checks passed
@fujiwara fujiwara deleted the cp-tncl branch August 26, 2024 07:25
@fujiwara fujiwara mentioned this pull request Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant