Download and Upload files between Cloud host and Local Device

Inside Out — and the other way around too.

Here’s the challenge:

You created a file on your development device and now you need to run it from a Host in AWS/Azure — How do you Upload it securely?

What if you need to download a file you modified in this Cloud hosted device into your local device for backup — How do you download this File securely?

Answer: Secure FTP, or SFTP for short.

What you’ll need:

  • Authentication Key to log in to the remote host.
  • Have SFTP installed on your device. It’s intalled by default in most modern OSs.

Scenario 1: Upload files to remote host:

  1. Open CLI on your local device, then Navigate to the location where the file you want to upload is located in your local machine.
  2. Then enter the command:

$ sftp -i <authenticationKey.pem> <hostname>@<remotehost’s PublicDNS>

  • where “hostname@location” can be found in your Cloud Provider’s “connect” section of your host.

3. Use the “PUT” command to upload the file you need.

$ cd <location>

$ put./<file>

4. You’ll see a notification stating the file was uploaded.

P.s.:

  • If you get a “permission denied” message, you need to check that all users can Write into the folder you’re trying to upload the file to.
  • This is RISKY not recommended. It should not be done unless absolutely necessary. AND If done, it must be temporary.
  • Return to “chmod 755…” (default) afterwards.
ls -ld <location>
chmod 777 <location>

Scenario 2: Download files from remote host:

  1. Open CLI on your local device, then enter the command:

$ sftp -i <authenticationKey.pem> <hostname>@<remotehost’s PublicDNS>

  • where “hostname@location” can be found in your Cloud Provider’s “connect” section of your host.

2. Navigate to file’s location and use the “GET” command to download it.

$ cd <location>

$ get ./<file>

3. You’ll see a notification stating the file was downloaded.

Download Progress notification

The file will be made available in your “Downloads” folder.

Cloud Security engineer — Andre has been an IT professional for a decade with a range of experience from Support, to Sales, to Consulting.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store