Ucodice Technologies
Ucodice Technologies Pvt. Ltd.
Ucodice Technologies Pvt. Ltd.
Ucodice Technologies Pvt. Ltd.

How to upload files from local computer to google compute virtual machine instance

I was trying to to upload files from my windows system to google's compute virtual machine instance.   I thought this guide will help people in future as details are not provided on tutorial given by google.

This guide can be used an assistance to gcloud file transfer from local computer to google instance or vice-versa.

Steps to manage upload/download files successfully:

1. First of all download the google cloud SDK Shell.  You can download it from following link:
    https://developers.google.com/cloud/sdk/?hl=es

2. After that run the google Cloud SDK. Now authenticate yourself, you can run following command to authenticate:
    gcloud auth login

    It will open a url in browser & you will be asked to enter your google account details.

3. Once this is done you are now authorized to run gcloud commands.

4. Now you are required to set correct project. You can find the correct project id or project name by clicking on Projects (First link of google developer console)
    https://console.developers.google.com/project

    Here you will get the project id or name to set the correct project run the following command:

    gcloud config set project PROJECTNAME

5.  After setting correct project, traverse to correct directory that you want to upload/transfer to your google Virtual Machine.

6.  After that run following command to upload file.
    gcloud compute copy-files [Source directory or file name] [destination directory of file name]

    Example of source directory or file name : test

    Example of destination directory or filename : test_gmail_com@YOURINSTANCENAME:/var/www/
    

You may face errors such as :

1.  You do not currently have an active account selected.
Solution : You may have not authenticated yourself correctly. Check the point number 2 above.

2. (gcloud.compute.copy-files) The required property [project] is not currently set.
Solution : Step no. 4 above is not done correctly.

3. Unable to fetch a list of zones. Specifying [--zone] may fix this issue. The resource 'projects/' was not found"
Solution : Correct project name was not set, check the step no. 4

4. "Invalid value  Values must match the following regular expression: '[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?'",
Solution : Path that you are giving in source may not be correct. Check the step no. 5

5.  (gcloud.compute.copy-files) Could not fetch instance:
Solution : You may have missed giving correct path with instance name & username of the instance step no. 6.  If you believe step 6 is correct then problem could be in step step no. 2 or 4.


6. Some requests did not succeed: - The resource 'projects/' was not found
Solution : Solution no. 5

 

 

Ucodice Technologies
Ucodice Technologies Pvt. Ltd.
Ucodice Technologies Pvt. Ltd.
Ucodice Technologies Pvt. Ltd.
Menu

Comments

  • samaresh182@gmail.com

    Very helpful article.

    • samaresh182@gmail.com
    • 4
  • bulent

    thanks great article

    • bulent
    • 4
  • Den

    Thnx!!!

    • Den
    • 4
  • Nitish

    The company website is quite awesome and impressive!! Good Job!!

    • Nitish
    • 4
  • Deepak Ray

    Will this work for Windows VM?

    • Deepak Ray
    • 4
  • jj455@cam.ac.uk

    I wish I have seen this earlier!

    • jj455@cam.ac.uk
    • 4

Please share your views with us

Check if you want to display your email-id.

Let's collaborate

write to us

contact@ucodice.com

Contact Form