Accessing a File on My Desktop and Saving It to Use in Google Cloud Shell

818 views Asked by At

I have a json file saved on my computer's desktop and would like to move it so it is saved in the desktop for Google Cloud Shell.

Any ideas on how you can do that?

1

There are 1 answers

0
vitooh On

There is a feature to download file to Cloud Shell as described here.

From the Cloud Shell web interface, you just need to click on the three-dot menu and click "Upload File": enter image description here

If the file you want to upload is large, from a local install of the gcloud command, you can copy using scp by running

gcloud beta cloud-shell scp cloudshell:~/data.txt localhost:~data.txt

Note that you have to be properly authenticated with your account and project, which you can do by running gcloud init and following the steps.

If the file you want to upload is huge, you can use GCS to store the file as an intermediate step (or as a final step if your file is too big for the Cloud Shell environment). You can upload the file through the web interface by going to a bucket and clicking the "upload files" button: enter image description here

If your file is very huge (up to 5 TB), the best option is to upload to GCS using the CLI. After setting up the CLI with gcloud init, you can run this command to upload the file to GCS:

gsutil cp -m ~/data.txt gs://<my-bucket>/data.txt

You can then retrieve the data in your cloud shell environment using the command line tool, or by mounting the bucket as a volume using GCSFuse.

I suggest to take a look at the whole documentation, as the Cloud Shell is really powerful tool. For example, I especially like editor which is fully browser based IDE, so it does not need any additional software than browser.