Last active
September 28, 2018 08:32
-
-
Save bgadrian/980e2fb79d1ce06d0e392d3f63c8a304 to your computer and use it in GitHub Desktop.
Google cloud gists
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if you use gcloud but the app requires | |
gcloud auth application-default login | |
export GOOGLE_APPLICATION_CREDENTIALS="/home/$USER/.config/gcloud/application_default_credentials.json" | |
#https://docs.docker.com/machine/drivers/gce/#example | |
docker-machine create --driver google --google-project YOURPORJECTID --google-machine-type f1-micro VMNAME |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#enable OS login for this project https://cloud.google.com/compute/docs/instances/managing-instance-access#enable_oslogin | |
gcloud compute project-info add-metadata --metadata enable-oslogin=TRUE | |
#add the key https://cloud.google.com/compute/docs/instances/managing-instance-access#add_oslogin_keys | |
gcloud compute os-login ssh-keys add \ | |
--key-file [KEY_FILE_PATH] \ | |
--ttl [EXPIRE_TIME] | |
#get the user | |
gcloud compute os-login describe-profile | |
ssh -i [PATH_TO_PRIVATE_KEY] [USERNAME]@[EXTERNAL_IP_ADDRESS] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment