How to Transfer a File from EC2 Server to Your Local Machine?

Share:
Transfer a File from EC2 Server to Local Machine


To download a file from an EC2 server to your local machine, you can use the scp (secure copy) command. Here are the steps:
  • Open a terminal window on your local machine.
  • Navigate to the directory where you want to save the file.
  • Use the scp command to copy the file from the EC2 server to your local machine. The syntax of the command is as follows:
scp -i /path/to/key.pem ec2-user@ec2-xx-xxx-xxx-xx.compute-1.amazonaws.com:/path/to/file /path/to/save/file

In this command, replace /path/to/key.pem with the path to your private key file, ec2-user with the username for your EC2 instance, ec2-xx-xxx-xxx-xx.compute-1.amazonaws.com with the public IP address or DNS name of your EC2 instance, /path/to/file with the path to the file you want to download on the EC2 instance, and /path/to/save/file with the path to the directory where you want to save the file on your local machine.
  • Press Enter and enter your EC2 instance password or SSH key passphrase if prompted.
  • The file will be downloaded from the EC2 server to your local machine.

No comments

'; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })();

Ads