This guide assumes that:
- you already have an instance set up on GCP that you want to mount locally
- the GCP CLI (
gcloud
) is installed on your local machine - you have authenticated locally to your google account
gcloud auth login
- make sure your gcloud config is correct for the instance you're trying to access:
gcloud config configurations list
- make a directory at the location you want to mount the file system, for example:
mkdir mnt/
mkdir mnt/<boxname>
- populate your ~/.ssh/config file with aliases for the instances in your project using
gcloud compute config-ssh
- Download and install sshfs and FuseOSX: https://github.com/osxfuse/osxfuse/wiki/SSHFS#installation
- mount away!
sshfs -o IdentityFile=~/.ssh/google_compute_engine \
<username>@<insance-name>.<region>.<project>:/path/to/location \
<path/to/local/mount/folder>
umount <path/to/local/mount/folder>
I succeeded after adding an additional chunk of configuration. Your instance must have the ability to SSH using "other client".
As I understand the process GCP adds an extra layer of security before allowing for ssh like connection. I followed instructions here: https://cloud.google.com/compute/docs/instances/connecting-advanced
and configured OSLogin (recommended way).
So it doesn't seem like
-o IdentityFile=~/.ssh/google_compute_engine
is possible anymore. It needs to be generated separately on the machine and added during OS Login setup. Exactly as described in the link. Also as target host needed to use IP.