2018年11月27日 星期二

2018年11月16日 星期五

Mount Google Cloud Storage in Linux

How to mount cloud storage (bucket)

If not in GCP, Setting Up Authentication for Server to Server Production Applications

Refer to https://cloud.google.com/docs/authentication/production#auth-cloud-app-engine-python
1. Generate service account credentials (a json file)
2. Set GOOGLE_APPLICATION_CREDENTIALS environment variable
# export GOOGLE_APPLICATION_CREDENTIALS="[PATH]"

Install FUSE

1. Configure the gcsfuse using yum repo:

# vi /etc/yum.repos.d/gcsfuse.repo

[gcsfuse]
name=gcsfuse (packages.cloud.google.com)
baseurl=https://packages.cloud.google.com/yum/repos/gcsfuse-el7-x86_64
enabled=1
gpgcheck=0
repo_gpgcheck=0

2. Install gcsfuse:

# yum install gcsfuse

3. To mount a bucket using gcsfuse over an existing directory /path/to/mount, invoke it like this:

# gcsfuse my-bucket /path/to/mount
or
# gcsfuse --implicit-dirs my-bucket /path/to/mount


Umount ----
# fusermount -u /path/to/mount