In this article, we will see the steps to upload files in Google gcloud VM Instance. Sometimes you might face a scenario in which you don't have access to a Virtual machine or any local Linux machine but you still need to work in your Google Cloud projects. This requires you to upload all your project files to the gcloud VM Instance so that you can use these files further with the Google Cloud Services. More on gcloud documentation.
What is gCloud VM Instance
A gCloud VM Instance is a running Debian based Linux operating system which gets provisioned on a per user basis. This instance will persist till the cloud session is active but will get discontinued and discarded after 1 hr of Inactivity. Cloud Shell provisions 5 GB of free persistent disk storage mounted as your $HOME directory on the virtual machine instance.
How to Upload Files to Google gcloud VM Instance
Also Read: How to Create Service in Google Cloud Run Using 6 Easy Steps
Step 1: Prerequisites
a) You should have a valid
Google Email ID and
b) You should have IAM access to upload files into the VM.
c) You should have access to a Project.
Step 2: Activate gcloud Shell
After checking all prerequisites, you need to first activate the
gcloud Shell. This can be done from Dashboard by clicking on below marked symbol
(>-). This will activate gcloud shell on the bottom of the page.
Step 3: Upload File
Once gcloud shell is opened, you can see a screen like below. Here you need to click on three dot as pointed below. You will get a list of option in which you need to click on
Upload File option. Then you can go to the respective folder and select the file which you want to Upload. Finally, Click on
Upload. It will upload the file in few minutes depending on the size of the file and the local bandwidth limit.
rootshell. You don't need
rootaccess to upload files. You can do it through your default gcloud login user as well. Only thing that will change is the uploaded file location.
All the uploaded files resides in User's home directory. Since here we are uploading file with root access so this file will be found under
/root directory which is the root home directory as you can see below. Here we have uploaded a sample
root@cloudshell:~$ ls cloudbuild.yaml README-cloudshell.txt root@cloudshell:~$ pwd /root
If you are logged in with some other user then you need to check that user home directory for the uploaded files. Default user home directory will be