skip to Main Content

I have a linux instance on AWS without a public IP address.

I know how to connect to it via the AWS CLI

aws ec2-instance-connect ssh --instance-id <INSTANCE_ID> 
  --private-key-file <PATH_TO_PRIVATE_KEY> --connection-type eice

How can I copy files from my local machine to my AWS instance? Usually I would use scp, however I do not have a public IPv4 address. How can I do this via the AWS CLI?

Thank you very much!

2

Answers


  1. You can try and do the scp using the below command, if it works then enjoy.

    scp -i <PATH_TO_PRIVATE_KEY> /path/to/local/file ec2-user@<PRIVATE_IP>:/path/to/destination/directory
    

    You need to establish your ssh connection first using the command you posted and then run scp and make sure to replace the required values.

    Login or Signup to reply.
  2. ec2 instance connect doesn’t have the scp component. You could either use AWS systems manager

    OR

    you need to login the aws network using vpn or Directconnect

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search