Google cloud storage provides a flexible and low cost storage option for virtual machines. Using Google cloud storage will allow you to maintain files in a common location that can be accessed from all your machine. You may also transfer data into and out of the cloud storage to your personal machine. Importantly, cloud storage is elastic in that it can be scaled to your needs.
In this file, we describe how to:
- Create a bucket in Google cloud storage
- Connect your VM instance to the bucket.
A bucket is the basic container in Google Cloud storage. We first need to create the bucket.
- Log in to the Cloud Developers Console, and go to Storage->Storage.
- This will prompt you to “Create” a new bucket
- For the name, I selected “introml-bucket”
- Select “Regional”
- Make sure region matches the region for your VM instance
- Optionally, you create “folders” within the bucket and load data into the bucket.
By default, VMs are generally created with read only access to Google cloud storage. To enable full access, you will need to modify the properties of your VM as follows:
- Go to Compute Engine -> VM instances. A list of your VMs should appear
- Click on the name of the VM that you wish to mount the bucket in. This will take you to a page “VM instance details”. The VM you are interested in should not be running.
- Select “Edit” from the top menu
- Under “Cloud API access scopes” select “Select Access for each API”. Within that menu select Full for Storage.
- Hit Save.
- Return to the main VM page
Finally, we need to mount the bucket in your VM with the tool gcs-fuse..
- Start the VM and SSH into the VM
- Follow the instructions on the gcs-fuse page for setting up gcs-fuse on your VM.
You should now be able to see the bucket files.