Upgrade to Pro — share decks privately, control downloads, hide ads and more …

AmazonCloudFrontで始めるお手軽簡単CDN

 AmazonCloudFrontで始めるお手軽簡単CDN

あなたのWebサイトも月◯◯円で爆速化できちゃうかも?

濱田孝治

April 19, 2018
Tweet

More Decks by 濱田孝治

Other Decks in Technology

Transcript

  1. 6    1 → 3 1 → 5

    1 → 6 32 ↑ 90 ↑ 106%↑
  2. 7    1 → 3 1 → 5

    1 → 6 1 → 7 1 → 10 32 ↑ 90 ↑ 106%↑ 113%↑ 123%↑
  3. 8  Web   X   Y New

    Industry Benchmarks for Mobile Page Speed - Think With Google https://www.thinkwithgoogle.com/marketing-resources/data-measurement/mobile-page-speed-new-industry-benchmarks/
  4. 9    1 3   32% 

      1 5   90%    1 6   106%    1 7   113%    1 10   123% 
  5. 21 Web  1.    2.  

    3.     
  6. 22 Web   1.    2. 

     3.   ! !  
  7. 25    Client Internet Web App Database •

       • Akamai •CloudFront •Cloud Flare • Nginx • Apache mod_cache • APCphp • API Gateway response cache • Amazon ElastiCache • redis • Memcached • Amazon DynamoDB Accelerator DAX
  8. 30 Web   1.    2. 

     3.   ! !  
  9. 31 Web   1.    2. 

     3.   ! !   AmazonCloudFront
  10. 34 %"Contents Delivery Network • Akamai •   &

    CDN $ • CloudFlare • !CDN  WordPress#   • Google Cloud CDN • GCP CDN 
  11. 35 AmazonCloudFront41 .:2  '7(   36*58=;%%<),9 CloudFront #%&

    ClientA ClientB ②%%+0 ③<) ①# ④# ⑤ ! <) '7($&"%/-
  12. 36 AmazonCloudFront&" ClientA ①  DNS )$ DB '%+ *!

    ②IP  ,xxx.cloudfront.net- )$ DB DNS ③%+Edge #( ④%+Edge  CloudFront
  13. 39 CloudFront  ① EC2    ② EC21RDS

        ③ EC2RDS    
  14. 42 4-)① CloudFront4-5B+2C Client Route 53 www.example.com A<(#(" EC2 ELB

    CloudFront '( 3   (#(". CloudFront %!& → D1*@ CloudFront!%!&) $A<(#("?, /;67> EC2D0:8  10  9=
  15. 43 ;52#① CloudFront;5<QH8R Client Route 53 www.example.com OG 1(1' CloudFront

    CloudFront OG 1(1' .&"/:B !$ AN6E>P S3OG+0,#(17? @9 S3 OG+06E>PS3 IL *+2-1#MD Q3F4%#  !)R=JCloudFront;5CK 
  16. 46 0)%② CloudFront0)1 Client Route 53 www.example.com +7$$ ELB EC2

    RDS CloudFront=7%+7% &;  !   !8/ .5 >1:? CloudFront #%"$4( 2< 329CloudFront %$4-*6 ',
  17. 48  ③ CloudFront Client Route 53 www.example.com  

    ELB App RDS App App img  wp- content/uploads/ NFS  EC2  
  18. 49 0)&③ CloudFront0)1 CloudFront Client :6%% *6%% ELB EC2 RDS

    php jpg png js css Route 53 www.example.com S3 :6%% 5( $ S337 #&!%- 2 + *6%% " & 9/8. 4 ,'
  19. 50 ③ • WordPress& S3 #(!"$ • %  )StaticPress

    S3 WP Offload S3 Lite* • goofys'Linux→S3   %
  20. 51 '! ③ CloudFront'!( CloudFront Client /, $, ELB EC2

    RDS S3 Route 53 www.example.com     2  S3Bucket +  UploadsC S S  JavaScript ◯ /wp-includes /wp-content Custom Origin WordPress*) $, HTML  △0.#,1 /login.php /wp-admin Default(*) CloudFront-%"&
  21. 53 • CDN $%C 9 />KH • GET/HEAD/OPTION (<I •

    URLB $%@L=;8F • +-!&,AF 6E"-  J08F • Header / Cookie / Query Strings URL ?57 +-!&,AF '#-1 :2.G $%34D $%,*-)AF
  22. 54  %#&"*-31,%%4 •  + 2  0 TTL

    /( • HTTP&  !!% & $&  • . ')/( OK
  23. 55 *+2"03/BHO8F2!2 P • .23$ ; HeaderCookie Query Strings&13# 8F(3

    M5 ;> • URL%C G *+2"03/: H • Whitelist6E '.3,284 = I %-)3&13# * +@7DE • *+ 2!2 .2 J 5?L9 M5NK9A< 
  24. 56  )-1 ,2 • + . - Amazon CloudFront

    • https://aws.amazon.com/jp/cloudfront/dynamic- content/ • CloudFront    # %/$!1'(02 • https://docs.aws.amazon.com/ja_jp/AmazonCloudFro nt/latest/DeveloperGuide/Expiration.html • Amazon CloudFront (/   (2015"6&*) • https://dev.classmethod.jp/cloud/cloudfront-cache- control/
  25. 58 5;4627>-=71? 5;8/ CloudFront< IP"' *< .,CloudFront   

    CloudFront Client +9(!( ELB EC2 RDS CloudFront$%!&)#:0  CloudFront IP"'*<13 
  26. 59 $ &#"1' CloudFront CloudFrontAWS WAF IP  % ELB

    EC2 RDS WAF IP  %  Client WAF ! 
  27. 60 4<3 526A.@6CB CloudFront Client CloudFront IP%9/1 ELB+  !#$(

    ;0 ELB EC2 RDS )7* &("'=:   IP%9/1 WAF ELB !#$( IP %,>? -8''
  28. 61 1;0 3/5=928?> CloudFront( ! $:,. WAF  ! $

    ELB < :, CloudFront Client *6## ELB EC2 RDS CloudFront( &) +27- ! $" ' % WAF WAF &) +4! $'%" ELB < WAF
  29. 68   • CDNCContents Delivery NetworkDWeb &?84/A7:<9; • Amazon

    CloudFront2<  @=- % -$  3=-%-$*#+ 6>    • , )"#')-(.!1 CloudFront   50 B