LoginSignup
4
2

More than 5 years have passed since last update.

Stackdriver Monitoring の Uptime Checkのアクセス元IPをFirewall Rulesを作る

Last updated at Posted at 2017-01-20

こんちは。
GCEのインスタンスへのアクセスをIPとかで制限したいけどUptime Checkもしたい場合、Stackdriverからのアクセス元IPを知りたいってのを以前に書きました。

今回はそのFirewall Ruleをサクッと作成する物体を書きました。
一応GitHubにソースコード置いときます。

IPのリストは2017年1月20日現在のものです。将来的に変わっていても私は責任を負いません。

gcloud compute firewall-rules create default-allow-uptimecheck \
    --allow=tcp \
    --description="Allow stackdriver uptime check" \
    --network=default \
    --source-ranges="146.148.119.250,146.148.41.163,146.148.59.114,23.251.144.62,54.232.81.104,54.232.88.155,54.232.88.172,54.235.161.191,54.244.253.127,54.245.81.104,54.245.81.193,54.251.48.52,54.251.48.53,54.251.48.56"

肝心のIPリストのテキストはここから取れます。

terraform

私はテラフォーマーなので、tfファイルも置いときますね。


resource "google_compute_firewall" "stackdriver_uptime" {
    name = "default-allow-stackdriver"
    network = "default"
    allow {
      protocol = "tcp"
      ports = ["80", "443"]
    }
    description = "allow stackdriver uptime check."
    source_ranges = [
      "104.155.110.139",
      "104.155.77.122",
      "107.21.113.149",
      "107.21.247.114",
      "146.148.119.250",
      "146.148.41.163",
      "146.148.59.114",
      "23.251.144.62",
      "54.232.81.104",
      "54.232.88.155",
      "54.232.88.172",
      "54.235.161.191",
      "54.244.253.127",
      "54.245.81.104",
      "54.245.81.193",
      "54.251.48.52",
      "54.251.48.53",
      "54.251.48.56"
    ]
}

ネットワーク、ポート、タグやらは適当に変えてください。

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