浅草橋青空市場

Microsoft Azure のニュースや情報を中心にあれこれと

Application Gateway V2 を試す

Igniteあたりの発表で Application Gateway が強化されたようだと聞いて少し試してみました。

手頃なリリースが見あたらなかったのでドキュメントにリンクしておきます。オートスケール対応、可用性ゾーン対応、パフォーマンス向上、デプロイや更新の高速化、静的IPアドレス、あたりが目玉ですね。

docs.microsoft.com

作り方(ポータル)

おもむろに Application Gateway を作ると、Tier の選択で「Standard V2」や「WAF V2」が選べます。試したところ、日本のリージョンはダメで、Southeast Asia でデプロイできました。

f:id:yhara90:20181003025317p:plain

作り方(PowerShell)

ドキュメントがありましたのでこちらからどうぞ。

docs.microsoft.com

デプロイや設定変更は早くなったのか?

6分35秒で完了しました。V1(16分23秒)に比べるとずいぶん高速化されましたね。設定変更も、バックエンドの追加が58秒で終わりました。

固定IPアドレスは?

新規作成の画面では Dynamic /Static の選択がグレーアウトして選べませんでしたが、デプロイ後に確認したら Static になっていました。FQDNは指定できます。また、既存のIPアドレスも指定できそうでした。

実際の FQDN はこんな感じ。ようやくv2仮想マシンベースになったようですね。

  • V1 の場合: f59c2f2a-c8fc-4f8d-92fa-6659b1a0105d.cloudapp.net
  • V2 の場合:: appgwv2testsea.southeastasia.cloudapp.azure.com

その他

デプロイ直後にアクセスしてみたら nginx から応答がありました。VMだけでなく中身も変わりましたか。

$ curl -I http://appgwv2testsea.southeastasia.cloudapp.azure.com/
HTTP/1.1 502 Bad Gateway
Server: nginx/1.13.8
Date: Tue, 02 Oct 2018 16:11:58 GMT
Content-Type: text/html
Content-Length: 173
Connection: keep-alive

とりあえずリダイレクト設定してみたところ。

$ curl -I http://appgwv2testsea.southeastasia.cloudapp.azure.com/
HTTP/1.1 301 Moved Permanently
Server: nginx/1.13.8
Date: Tue, 02 Oct 2018 16:23:25 GMT
Content-Type: text/html
Content-Length: 185
Connection: keep-alive
Location: http://example.com/

V1 だとIISからの応答ですね。

$ curl -I http://104.215.176.233/
HTTP/1.1 502 Bad Gateway
Content-Length: 1477
Content-Type: text/html
Server: Microsoft-IIS/10.0
Date: Tue, 02 Oct 2018 16:25:27 GMT

$ curl -I http://104.215.176.233/
HTTP/1.1 301 Moved Permanently
Content-Length: 141
Content-Type: text/html; charset=UTF-8
Location: http://example.com/
Server: Microsoft-IIS/10.0
Date: Tue, 02 Oct 2018 16:46:14 GMT

ログも微妙に変わってました

もしかしてと思ってストレージに出力されるログを見てみたら微妙に変わっていました。InstanceId が、Cloud Services 的な名前から VMSS っぽい名前になりましたね。

V1 のログ

{
        "resourceId": "(省略)",
        "operationName": "ApplicationGatewayAccess",
        "time": "2018-10-02T17:32:59Z",
        "category": "ApplicationGatewayAccessLog",
        "properties": {"instanceId":"ApplicationGatewayRole_IN_0","clientIP":"51.141.54.177","clientPort":27665,"httpMethod":"GET","requestUri":"/","requestQuery":"-","userAgent":"Mozilla/5.0+(compatible;+MSIE+9.0;+Windows+NT+6.1;+Trident/5.0;+AppInsights)","httpStatus":301,"httpVersion":"HTTP/1.1","receivedBytes":553,"sentBytes":331,"timeTaken":235,"sslEnabled":"off","host":"104.215.176.233"}
}

V2 のログ

{
        "timeStamp": "2018-10-02T17:34:44+00:00",
        "resourceId": "(省略)",
        "operationName": "ApplicationGatewayAccess",
        "category": "ApplicationGatewayAccessLog",
        "properties": {"instanceId"=>"vm000003", "clientIP"=>"52.174.166.113", "clientPort"=>"19569", "httpMethod"=>"GET", "requestUri"=>"/", "requestQuery"=>"", "userAgent"=>"Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0; AppInsights)", "httpStatus"=>"301", "httpVersion"=>"HTTP/1.1", "receivedBytes"=>"549", "sentBytes"=>"377", "timeTaken"=>"0.000", "host"=>"vm000003"},
        "time": "2018-10-02T17:34:44.0000000Z"
}

簡単ですがこんなところで。いろいろと楽しみですね。