S3 & ELB & Varnish

2,816 views

Published on

Published in: Technology, Business
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,816
On SlideShare
0
From Embeds
0
Number of Embeds
1,389
Actions
Shares
0
Downloads
7
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

S3 & ELB & Varnish

  1. 1. S3 & ELB & Varnish @suz_labThursday, November 10, 11
  2. 2. cloudpackThursday, November 10, 11
  3. 3. suz-labThursday, November 10, 11
  4. 4. S3 • HTTPでコンテンツをダウンロード • 堅牢性 : 99.999999999% : 99.99% (RRD) • 可用性 : 99.99% • SLA : 99.9%Thursday, November 10, 11
  5. 5. ELB • ロードバランサー • SSL Termination • 実は一つのEC2に複数のELBが接続可能 (AWS Management Console ではできない... )Thursday, November 10, 11
  6. 6. Varnish • コンテンツキャッシュサーバ • リバースプロキシーサーバ • HTTPヘッダの操作Thursday, November 10, 11
  7. 7. S3 & ELB & Varnish • S3 の HTTPS での独自ドメイン • S3 への POST アクセス • S3 のレスポンスに独自ヘッダ • S3 & ELB の Zone Apex 対策Thursday, November 10, 11
  8. 8. S3 の HTTPS での 独自ドメイン • Facebookアプリ • HTTPSはELBで処理 • N(ELB) : 1(Varnish)Thursday, November 10, 11
  9. 9. 設定例 sub vcl_recv { if(req.http.host == "www.cloudpack.jp") { set req.backend = cloudpack; set req.http.host = "s3.www.cloudpack.jp"; return(lookup); } return(error); } backend cloudpack { .host = "s3.www.cloudpack.jp"; .port = "80"; }Thursday, November 10, 11
  10. 10. S3 への POST アクセス • Facebookアプリ • POSTをGETに変換Thursday, November 10, 11
  11. 11. 設定例 sub vcl_recv { if(req.http.host == "www.cloudpack.jp") { set req.backend = cloudpack; set req.http.host = "s3.www.cloudpack.jp"; set req.request = "GET"; return(lookup); } return(error); }Thursday, November 10, 11
  12. 12. S3 のレスポンスに 独自ヘッダ • 携帯画像(SoftBank) の著作権保護機能 • x-jphone-copyright • SoftBank以外はOK...Thursday, November 10, 11
  13. 13. 設定例 sub vcl_recv { if(req.http.host == "www.cloudpack.jp") { set req.backend = cloudpack; set req.http.host = "s3.www.cloudpack.jp"; return(lookup); } return(error); } sub vcl_fetch { if(req.http.host == "s3.www.cloudpack.jp") { set beresp.http.x-jphone-copyright = "no-transfer"; } return(deliver); }Thursday, November 10, 11
  14. 14. S3 & ELB の Zone Apex 対策 • ELB で Route53 なら不要 • cloudpack.jp の頭に www つけて リダイレクト(301)Thursday, November 10, 11
  15. 15. 設定例 sub vcl_error { set obj.http.Content-Type = "text/plain; charset=utf-8"; if(req.url == "/healthcheck.txt") { set obj.status = 200; synthetic {"health check"}; } else { set obj.http.Location = "http://www." req.http.host req.url; set obj.status = 301; } return(deliver); }Thursday, November 10, 11
  16. 16. cloudpack ToolsThursday, November 10, 11

×