Transferring files with gcloud

Transferring files back and forth from your machine (or any other location) and your instance is done via Gcloud's version of the .csp command:

  • To send a local file to your instance $HOME folder:
$ gcloud compute scp ~/LOCAL-FILE :~/
  • For instance, to send a file titled hello_world.txt to sparrow, you would run this:
$ gcloud compute scp ~/hello_world.txt sparrow:~/
  • Similarly, to download a file from the instance to your local machine $HOME folder:
$ gcloud compute scp <instance-name>:~/REMOTE-FILE ~/

We will explore the gsutil and bq command-line tools in the next chapter and the Datalab CLI in Chapter 4, Querying Your data with BigQuery.