みーのぺーじ

みーが趣味でやっているPCやソフトウェアについて.Python, Javascript, Processing, Unityなど.

Google Cloud PlatformでDDoS対策を考える

Google Cloud PlatformでDDoS対策を考えてみました。

Google Front End Serviceを利用する

When a service wants to make itself available on the Internet, it can register itself with an infrastructure service called the Google Front End (GFE). The GFE ensures that all TLS connections are terminated using correct certificates and following best practices such as supporting perfect forward secrecy. The GFE additionally applies protections against Denial of Service attacks.

サービスをインターネット上で利用可能にするために、Google Front End (GFE) と呼ばれるサービス基盤に登録します。これにより、全てのTLS接続が、正しい証明書を用いて、Perfect Forward Secrecy (PFS)などのベストプラクティスに従って終端処理されることが保証されます。また、DDoS攻撃に対する防御を追加で提供します。拙訳みー。

Google Infrastructure Security Design Overview  |  Solutions  |  Google Cloud

Google曰く、WebサーバーをGFEの後ろに設置すれば、自動的にDDoS攻撃から守られるようです。例えば、Global external HTTP(S) load balancer (classic)の後ろにWebサーバーを設置すればよいわけです。

サーバーの使用量を制限する

Compute Engine APIを使用している場合は、使用率を制限できます。

API rate limits  |  Compute Engine Documentation  |  Google Cloud

Cloud RunやCloud Functionsなどのサーバーレス環境ならば、最大インスタンス数を設定して使用率を制限できます。

Setting a maximum number of container instances  |  Cloud Run Documentation  |  Google Cloud

この対応により、DDoS攻撃を受けた場合にサービスが停止しますが、請求額の上昇速度を減らせるので、クラウド破産するリスクを減らせます。

Cloud Armorを使用する

Web Application Firewall (WAF) とDDoS攻撃の防御をするサービスで、 Cloud Load Balancingの後ろで攻撃を検知し対応します。

Cloud Armor Network Security  |  Google Cloud Armor

Plus Tierに加入すれば、実際にDDoS攻撃を受けた場合に請求金額を減らす申請が可能となるようですが、月に348,000円 (3,000ドルを2022/02/11現在の為替相場で換算)の固定費用が発生するため、それなりの規模のWebサービスでなければメリットがないように思います。

Pricing  |  Google Cloud Armor

不用意に外部に公開しない

そもそも公開しなければDDoS攻撃を受けないので、不要なサービスを停止させたり、プライベートネットワーク内で処理をしたりするなど、工夫をするべきです。