Last active
March 29, 2018 15:31
-
-
Save mrdotb/94a8f7a07fe696a577ebb5e8d4f91718 to your computer and use it in GitHub Desktop.
create ssh_config file from google compute engine project
This file contains 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
gcloud config set project $PROJECT_ID | |
gcloud compute instances list --format json | jq -M '.[] | select(.status == "RUNNING") | "Host \(.name)\n hostname \(.networkInterfaces[0].accessConfigs[0].natIP)\n user $USER\n port $SSH_PORT\n"' | sed 's/\\n/\n/g' | sed 's/"//g' > ssh_config |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment