やったこと
Google Cloud はhttps://www.gstatic.com/ipranges/cloud.json というサイトでGoogle Cloud で利用しているIP rangeが公開されている。余談ではありますがAWSは同様に https://ip-ranges.amazonaws.com/ip-ranges.json に公開されている。
みんなが大好きなjq
コマンドのselect
でscope
の値がasia-northeast1
なものだけを抜き出しています。
また、サービスによって自分の利用しているリージョン以外へのアクセスが必要なものもあると思うのでアクセスリストを作る際には気をつけてほしいです。
curl -s https://www.gstatic.com/ipranges/cloud.json | jq -r '.prefixes[] | select(.scope == "asia-northeast1") | .ipv4Prefix' | grep -v null
結果(asia-northeast1)で利用されているIPアドレス
34.84.0.0/16 34.85.0.0/17 34.104.62.0/23 34.104.128.0/17 34.127.190.0/23 34.146.0.0/16 34.157.64.0/20 34.157.164.0/22 34.157.192.0/20 35.187.192.0/19 35.189.128.0/19 35.190.224.0/20 35.194.96.0/19 35.200.0.0/17 35.213.0.0/17 35.220.56.0/22 35.221.64.0/18 35.230.240.0/20 35.242.56.0/22 35.243.64.0/18 104.198.80.0/20 104.198.112.0/20