How to upload files to your Amazon AWS instance using the bash shell and sftp.

Posted: September 24, 2014. At: 9:47 PM. This was 3 years ago. Post ID: 7764
Page permalink: http://securitronlinux.com/bejiitaswrath/how-to-upload-files-to-your-amazon-aws-instance-using-the-bash-shell-and-sftp/

Now, we must convince Congress to stop the FCC. Can you display an alert?

This is how to copy files from the local machine to your Amazon instance when you are logged into the EC2 instance via SSH.

Firstly, connect to the remote AWS instance by SSH. Then use the sftp command to connect back to your local Linux machine.

sftp -P 443 jason@1xx.xxx.xxx.xx

Then, you may use the GET command to retrieve the file or directory that you are after.

sftp> get /etc/openvpn/*
Fetching /etc/openvpn/ca.crt to ca.crt
/etc/openvpn/ca.crt                                                                                                                                                                100% 1777     1.7KB/s   00:00    
Fetching /etc/openvpn/ca.key to ca.key
/etc/openvpn/ca.key                                                                                                                                                                100% 1704     1.7KB/s   00:01    
Fetching /etc/openvpn/client.conf to client.conf
/etc/openvpn/client.conf                                                                                                                                                           100% 3439     3.4KB/s   00:00    
Fetching /etc/openvpn/deepthought.crt to deepthought.crt
/etc/openvpn/deepthought.crt                                                                                                                                                       100% 5564     5.4KB/s   00:00    
Fetching /etc/openvpn/deepthought.csr to deepthought.csr
/etc/openvpn/deepthought.csr                                                                                                                                                       100% 1094     1.1KB/s   00:00    
Fetching /etc/openvpn/deepthought.key to deepthought.key
/etc/openvpn/deepthought.key                                                                                                                                                       100% 1708     1.7KB/s   00:00    
Fetching /etc/openvpn/deusexmachina.crt to deusexmachina.crt
/etc/openvpn/deusexmachina.crt                                                                                                                                                     100% 5686     5.6KB/s   00:00    
Fetching /etc/openvpn/deusexmachina.csr to deusexmachina.csr
/etc/openvpn/deusexmachina.csr                                                                                                                                                     100% 1094     1.1KB/s   00:00    
Fetching /etc/openvpn/deusexmachina.key to deusexmachina.key
/etc/openvpn/deusexmachina.key                                                                                                                                                     100% 1704     1.7KB/s   00:00    
Fetching /etc/openvpn/dh2048.pem to dh2048.pem
/etc/openvpn/dh2048.pem                                                                                                                                                            100%  424     0.4KB/s   00:00    
Fetching /etc/openvpn/ipp.txt to ipp.txt
/etc/openvpn/ipp.txt                                                                                                                                                               100%   17     0.0KB/s   00:01    
Fetching /etc/openvpn/openvpn-status.log to openvpn-status.log
/etc/openvpn/openvpn-status.log                                                                                                                                                    100%  232     0.2KB/s   00:00    
Fetching /etc/openvpn/server.conf to server.conf
/etc/openvpn/server.conf                                                                                                                                                           100%   10KB  10.0KB/s   00:01    
Fetching /etc/openvpn/update-resolv-conf to update-resolv-conf
/etc/openvpn/update-resolv-conf

This will upload all of the requested files into the current directory. This is a good way to upload a required file when you need it right now.

No comments have been made. Use this form to start the conversation :)

Leave a Reply