Skip to content

Instantly share code, notes, and snippets.

@ryosebach
Created May 23, 2019 05:19
Show Gist options
  • Select an option

  • Save ryosebach/5a06fd586bc23f0a6fa991a9509c5421 to your computer and use it in GitHub Desktop.

Select an option

Save ryosebach/5a06fd586bc23f0a6fa991a9509c5421 to your computer and use it in GitHub Desktop.
gcloudでインスタンスの内部IPと外部IPを取得するコマンド

内部IPアドレスの取得

gcloud compute instances list --format="value(networkInterfaces[].networkIP)" --filter="name='xxxxxx-xxxxx'"

外部IPアドレスの取得

gcloud compute instances list --format="value(networkInterfaces[].accessConfigs[0].natIP)" --filter="name='xxxxxx-xxxxx'" 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment