aws / aws-ec2-instance-connect-cli

This is an all-in-one client for EC2 Instance Connect that handles key brokerage and establishing connection to EC2 Instances through an interface near-identical to standard system ssh, sftp, and other utilities.
Apache License 2.0
160 stars 42 forks source link

Please add "scp" mode #1

Open tyrken opened 5 years ago

tyrken commented 5 years ago

I'm hoping you can add this in similar fashion to the msftp/mssh wrappers, as we find this a lot more natural to use than sftp

stevenhwu commented 5 years ago

Really looking forward for something mscp. Currently I still have to use existing AWS key or send my own key first, before I can scp/rsync files. Please let me know if there are ways to do it already and I completely miss it.

LordAlfredo commented 5 years ago

Thank you for the feedback. We recognize that scp is a high priority for our customers and have it very high on our feature request list.

MaerF0x0 commented 5 years ago

+1 also when exploring implementing this feature, please also consider rsync compatibility too .

akotian commented 4 years ago

Anybody stumbling across this, wanting to transfer files to and from the machine, might find this useful. There is an msftp option. so msftp instance_id and regular sFTP options should work.

squirer commented 4 years ago

Hi there, i'm just wondering if there is a feature now to Amazon instance connect that allows users to copy files to remote ec2 instances? At the moment we are allowing our internal admin users access to EC2 using mssh but we cannot see a way of copying files without providing the original pem key that was used to set up the instance

rnikoopour commented 4 years ago

@squirer Check out the msftp option for copying files across without using mssh first.

viotti commented 4 years ago

@stevenhwu you can use the -e option of rsync to leverage mssh on the file transfer. This will relieve you from having to create a key par a priori.

rsync -a -e mssh SOURCE_DIR/ USER@INSTANCE_ID:TARGET_DIR

You can even pass options to mssh in the -e argument.

rsync -a -e "mssh MSSH_OPTS" SOURCE_DIR/ USER@INSTANCE_ID:TARGET_DIR
stevenhwu commented 4 years ago

@viotti Thank so this efficient solution!

Maks3w commented 3 years ago

This implementation is written purely inside of ssh_config so it works transparent with SCP (tested)

https://gist.github.com/Maks3w/de72b0160d5e6af958adc42eab014624

BastiQ commented 1 year ago

@stevenhwu you can use the -e option of rsync to leverage mssh on the file transfer. This will relieve you from having to create a key par a priori.

rsync -a -e mssh SOURCE_DIR/ USER@INSTANCE_ID:TARGET_DIR

You can even pass options to mssh in the -e argument.

rsync -a -e "mssh MSSH_OPTS" SOURCE_DIR/ USER@INSTANCE_ID:TARGET_DIR

Using your solution, I run into the following error message

protocol version mismatch -- is your shell clean?
(see the rsync man page for an explanation)

After some research, I think it's because of the output from Amazon Linux when connecting to the instance:

       __|  __|_  )
       _|  (     /   Amazon Linux 2 AMI
      ___|\___|___|

https://aws.amazon.com/amazon-linux-2/

Anyone else facing this issue? Any solutions to this?

BastiQ commented 1 year ago

Never mind, I had to update rsync on my Mac using brew install rsync and then sign out and back in again and it worked!

tdalbo92 commented 8 months ago

Is there any update from the AWS product team on this? These workarounds are helpful, but proper support would be a lot more reasonable to have.

amelnikoff commented 1 month ago

We recognize that scp is a high priority for our customers

And then ignore it?