---
title: "Google Project Shieldを試してみた！ | grasys blog"
url: "https://blog.grasys.io/post/yusukeh/googleprojectshield/"
description: "GoogleのDDoS対策サービスのProject Shieldを使う機会があったので紹介！ 登録はかなり前にしていたんですが、人力による承認制になっているためなかなか使えるようになりません。 細かい説明はGoogle先生に聞いてください。 Newsサイトなどじゃないとそもそも登録申請が通りません・・・ 設定に必要な…"
---

# Google Project Shieldを試してみた！

-   ![](/_astro/noicon.CTHOhNiB_1HMs6A.webp)[yusukeh](/authors/yusukeh/)
-   公開日：2017年5月16日
-   カテゴリー：[Tech](/categories/tech/)
-   タグ：[#projectshield](/tags/projectshield/)

![Google Project Shieldを試してみた！](/_astro/ogp.Cm-gYwrf_ZKdu3d.webp)

GoogleのDDoS対策サービスの[Project Shield](https://projectshield.withgoogle.com/)を使う機会があったので紹介！

登録はかなり前にしていたんですが、人力による承認制になっているためなかなか使えるようになりません。

細かい説明はGoogle先生に聞いてください。  
Newsサイトなどじゃないとそもそも登録申請が通りません・・・

## 設定に必要なもの

以下の2つだけ

-   導入したいDNSのレコード変更権限
-   エンドポイントのIPをひとつ

あとは公開しているサイトがあれば大丈夫！

### Add a new site

左のメニューにある「Add a new site」でサイトの追加ができます。

![Add a new siteの画面](/_astro/01-Project_Shield_Add_a_new_site-1024x751-e313c1d2.RpIvdED5_tEjXT.webp)

ページ下部の「OKAY, LET’S GET STARTED」をクリック！

### What’s your domain name?

ドメイン名を入れてください。

![What’s your domain name?の画面](/_astro/02-Project_Shield_Whats_your_domain_name-1024x751-eb687caf.C8zZo1iF_Z2idGgJ.webp)

Proxy bare domainはオリジンのAレコードからのリダイレクト設定になります。

ex) [http://grasys.io/](http://grasys.io/) -> [http://www.grasys.io/](http://www.grasys.io/)

SSL設定も可能です。

> grasys.ioの購入中ですぐ利用できなかった・・・

### Verify ownership

![Verify ownershipの画面](/_astro/03-Project_Shield_Verify_ownership-1024x751-7edb328a.DqOUgrxK_Z774Ab.webp)

Documentは[こちら](https://support.google.com/projectshield/answer/6358840?hl=en&ref_topic=6358112#verify_website_ownership)

結論からいうとGoogle Search ConsoleでDomainの所有を証明しておけば完了します。

### Where is your content?

![Where is your content?の画面](/_astro/04-Project_Shield_Where_is_your_content-1024x751-775ff4b0.B1yi-uSz_Z1HJEBj.webp)

Load BalancerやInstanceのExternal IPなどを入れましょう。

### Sending traffic to Project Shield

出て来る画面の情報どおりにDNSを設定する！

![Project Shieldへトラフィックを送るためのDNS設定案内](/_astro/05-Project_Shield_Sending_traffic_to_Project_Shield-cf2d7c93.BImOypf__Z27MyPA.webp)

### Congratulations!

設定完了！

![Congratulationsの画面（1）](/_astro/06-Project_Shield_Congratulations-1024x749-d04f857d.DYPljQdl_5Q9kk.webp)

あとは何回かアクセスしてみるだけ！

DNSとIP設定が正しければ疎通できるようになります。

一応digとかで確認もしてみる

![Congratulationsの画面（2）](/_astro/07-Project_Shield_dig-ae771900.CcRZXWee_Zo9t1I.webp)

## Project Shieldの画面

Project Shieldはこんな画面

![Project Shieldの画面（1）](/_astro/08-Project_Shield_Jigsaw-1024x554-6367159e.CNcTUZ4m_ZvKIXu.webp)

設定はこんな感じになっています。

![Project Shieldの画面（2）](/_astro/09-Project_Shield_Settings-1024x525-798b3526.Cy6jnG3-_ZyFxJR.webp)

Graphもいくつか用意されています。

QPS / Cache Status

![Project Shieldの画面（3）](/_astro/10-Project_Shield_graph1-1e440eb5.DZnfeiH7_La7wK.webp)

Error Code QPS / Error Percentage

![Project Shieldの画面（4）](/_astro/11-Project_Shield_graph2-1024x534-d2bb8714.BARvI96M_1nw6ex.webp)

Ingress Bandwidth / Egress Bandwidth

![Project Shieldの画面（5）](/_astro/12-Project_Shield_graph3-8046f99d.CX38ZErD_2lSG45.webp)

## Project ShieldのCacheについて

[Caching on Project Shield](https://support.google.com/projectshield/answer/7258590?hl=en&ref_topic=6358117)

ここに詳細はありますが基本は単純で  
Cache-Controlで設定するだけみたいです。

* * *

## Appendix

今回Project Shieldを導入するために構成を変更しました。

もともとは以下の構成

-   Cloud Storage Site Hosting
-   CNAMEのFQDN付きBucket
-   Edge Cache

今回将来的にSSL化もする予定（購入中）なので以下のように構成変更しました。

-   HTTP(S) Load Balancer
-   Backent Service Bucket
-   Cloud Storage Bucket

![Appendixを示す構成図](/_astro/13-grasys_Site_Architecture-1024x791-d91d348f.DIJjWtKt_1xkfLP.webp)

HTTP(S) Load BalancerのExternal IPをProject ShieldのEndpointに設定してます。

* * *

追記 2017-05-16

## Cloud Storage Cache-Control変更

ちょっと今までCloud StorageのEdgeCacheに任せていて  
そこにHTTP(S) Load BalancerのCloud CDNをかぶせてしまったｗ

Cache長すぎてちょっとあれなんでちょっとUploadいじりました。

Plain textcontent\_copy

```
gsutil -m -h "Cache-Control: public,max-age=300" cp -R -z js,css,html ${src_dir}/* ${bucket}
```

## Response Headerがなんかかっこいいｗ

Plain textcontent\_copy

```
$ curl -s -I http://www.grasys.io
HTTP/1.1 200 OK
Server: shield
Date: Tue, 16 May 2017 10:17:37 GMT
Content-Type: text/html
Content-Length: 8422
X-GUploader-UploadID: AEnB2UojNyCOgEOLTWXraDiqF7ZT2VUr91QWRAooeaR18BK1Isr4bYh09Q9cjzj8I4L2yx7B1CAyLXr1b80l3YklgB-BSvIFKw
Expires: Tue, 16 May 2017 10:07:30 GMT
Last-Modified: Mon, 15 May 2017 04:52:28 GMT
ETag: "deeb5b907001c4f0561460e561fb025f"
x-goog-generation: 1494823948892790
x-goog-metageneration: 1
x-goog-stored-content-encoding: gzip
x-goog-stored-content-length: 8422
Content-Encoding: gzip
x-goog-hash: crc32c=s/ixAw==
x-goog-hash: md5=3utbkHABxPBWFGDlYfsCXw==
x-goog-storage-class: STANDARD
Cache-Control: public,max-age=300,no-transform
Age: 0
Accept-Ranges: bytes
Via: 1.1 google
```

## SSL追加

SSLを有効化しました。  
そしたら当たり前だけど今までCNAMEだったのがA Recordへの変更が必要になりました。

![SSL追加の画面](/_astro/14-Project_Shield_ssl_enabled-1024x311-440123d2.BT-Y64eT_Z1tT6Kh.webp)

## この記事を書いた人

[![](/_astro/yusukeh.BvUd2yKE_1mQ6Fp.webp)](/authors/yusukeh/)

### [yusukeh](/authors/yusukeh/)

Fly high. Think deep. Move fast. Go far.🦅

-   [Medium](https://medium.com/@yusukeh "Medium")

[プロフィールと記事一覧](/authors/yusukeh/)