LoginSignup
4
2

More than 5 years have passed since last update.

GoogleデータスタジオはどこからMySQLやPostgreSQLにアクセスしてくるのか

Posted at

Googleデータスタジオは、グローバルからアクセス可能なMySQLやPostgreSQLのテーブルもデータソースとすることができます。

この機能を使うと、自社のサービスのデータダッシュボードを簡単に構築することもできますが、データベースの接続をオープンにするのは大問題なので、Googleデータスタジオからの接続のみにIPアドレスで制限する設定が必要です。

接続元のネットワーク

Googleデータスタジオの接続元ネットワークは次のページに記載があります。

どの地域からのアクセスか

このネットワークが物理的にどこに存在するのか、Geo IPで確認しました(各帯域の先頭IPアドレスで地域を参照しています)。

64.18.0.1   United States New York
64.233.160.1    United States Newark
66.102.0.1  United States Ashburn
66.249.80.1 United States Galveston
72.14.192.1 United States Ashburn
74.125.0.1  United States Ashburn
108.177.8.1 United States Ashburn
173.194.0.1 United States Monroe
207.126.144.1   United States Newark
209.85.128.1    United States Ashburn
216.58.192.1    United States Draper
216.239.32.1    United States Mountain View

すべて米国でした。
もしかしたら地域ごとに分散されているかと思いましたが、そういうわけではなさそうです。

地域を確認するスクリプト

参考までにこんなスクリプトで地域を確認しました。

#!/bin/bash

LIST=$(cat << EOL
64.18.0.1
64.233.160.1
66.102.0.1
66.249.80.1
72.14.192.1
74.125.0.1
108.177.8.1
173.194.0.1
207.126.144.1
209.85.128.1
216.58.192.1
216.239.32.1
EOL
)

for IP in $LIST
do
  JSON=$(curl -s -S http://ip-api.com/json/$IP)
  LOC=$(echo $JSON | jq -r "[.country, .city] | @tsv")
  echo $IP$'\t'$LOC
done

Ubuntuでファイアウォールを開放するスクリプト

UbuntuでGoogleデータスタジオ向けにファイアウォールを公開するスクリプトです。こちらもオマケにどうぞ。

#!/bin/bash

LIST=$(cat << EOL
64.18.0.0/20
64.233.160.0/19
66.102.0.0/20
66.249.80.0/20
72.14.192.0/18
74.125.0.0/16
108.177.8.0/21
173.194.0.0/16
207.126.144.0/20
209.85.128.0/17
216.58.192.0/19
216.239.32.0/19
EOL
)

for IP in $LIST
do
  sudo ufw allow from 216.239.32.0/19 to any port 3306
done

sudo ufw status
sudo ufw enable
4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2