Skip to content

Instantly share code, notes, and snippets.

@holysugar
Created June 18, 2015 03:26
Show Gist options
  • Save holysugar/714f9f7c76e9557ac89a to your computer and use it in GitHub Desktop.
Save holysugar/714f9f7c76e9557ac89a to your computer and use it in GitHub Desktop.
GCE でインスタンス名からCloudSQLにアクセス許可するワンライナー(手抜き版)
gcloud compute instances list |
grep '^projectname-web' |
awk '{print $5}' |
tr "\n" " " |
xargs gcloud sql instances patch dbinstancename --authorized-network
# 本来はタグとかメタデータとかから取る方針にしたいのでこれは手抜き。
# CloudSQL 側でもっと (GAEではなく) GCEなどから受け取れる前提で設定を簡単にできるようにならないのかな…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment