🌑

Stephen Cheng

How to Transfer Files & Connect to Jupyter Notebook Between Azure Virtual Machines and Local Systems

 

Stephen Cheng

Intro

Recently, cloud platforms are popular among various companies and conferences. Virtual Machines are one of the main applications provided by cloud platforms. For instance, Microsoft Azure offers Data Science Virtual Machines. Even though we have cloud platforms do us a favour to process hundreds and thousands of data remotely, I do need to upload files or download results from remote server. So how to interact between remote cloud servers and local systems? We’ll take Azure Virtual Machines as a case study.

Transfer Files

  • Copy a Local File to a Azure Virtual Machine with the scp Command:
1
scp /local/path/file.txt azure_username@azure_host_ip:/remote/directory
  • If SSH on the remote host is listening on a port other than the default 22, then you can specify a port using the -P argument:
1
scp -P 1234 /local/path/file.txt azure_username@azure_host_ip:/remote/directory
  • To copy a directory from a local to remote system, we can use the -r option:
1
scp -r /local/directory azure_username@azure_host_ip:/remote/directory
  • Copy a Remote File to a Local System using the scp command:
1
scp azure_username@azure_host_ip:/remote/file.txt /local/directory
  • Copy a File Between Two Azure Virtual Machines using the scp Command:
1
scp azure_username1@azure_host_ip1:/directory/file.txt azure_username2@azure_host_ip2:/directory

Connect to Azure Virtual Machine

Here, we can use SSH command to connect to the Azure Virtual Machine from local path.

1
ssh azure_username@azure_host_ip

Connect to Jupyter Notebook application

Here, we use SSH command to connect to the Jupyter Notebook Application.

  • First, install and start the Jupyter Notebook Application in the Azure Virtual Machines, then open the local terminal and input the following command:
1
ssh -L 8000:localhost:8888 azure_username@azure_host_ip
  • Next, entering to the Jupyter Notebook Application using local browser with the url ‘localhost:8000’, and input the Jupyter notebook token from Azure Virtual Machines.

, , — Jan 28, 2019

Search

    Made with ❤️ and ☀️ on Earth.