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

今からでも遅くない_基礎から学ぶサーバーレス開発_-キホンの_キ_-.pdf

119659c28d16f22d01eb48a6f3ee1391?s=47 TomoyaIwata
October 05, 2018

 今からでも遅くない_基礎から学ぶサーバーレス開発_-キホンの_キ_-.pdf

2018/10/5に開催されたDevelopers.IO 2018で登壇した際の資料です

119659c28d16f22d01eb48a6f3ee1391?s=128

TomoyaIwata

October 05, 2018
Tweet

More Decks by TomoyaIwata

Other Decks in Technology

Transcript

  1.       -   -

  2. & .-*  (2  ,0'/4"# 51  83;7 +)

    !&%$9( 6:  Attention
  3. 3 /1) l  ( l20185 l'5Sier l#. &! l#.

    (C/S+LAMP+) l"%AWS$-3 l2*  , 04
  4. 4  :@" 2-1AWS.8 4  9;=&#IaaS6  •57*3!%( •$'><+

    ) •$'0, :)  !" ?/  
  5. 5  26  • !-4'$ 18 8( • &

    # • &  • ,/ & +)07 *. • & % " 35 •   8( 5( 5( 8( 3(
  6. 6  26  • !-4'$ 18 8( • &

    # • &  • ,/ & +)07 *. • & % " 35 •   8( 5( 5( 8( 3(
  7. 7     6/" F>- # $BDGH &

    +1 $BD ?,GH ! .@ ;5 !  6/"82 ( 3 $BD  GH ! .@ E07: "82( !  )* ! .@ % F>"9 ( 4A C=<'
  8. 8   *% 510  $!  ) 

     1" 2" 3" 4" 5" &#' (,  +  (,
  9. 9 −        

     0 10 20 30 40 50 60 70 80 90 100 0:00 2:00 4:00 6:00 8:00 10:00 12:00 14:00 16:00 18:00 20:00 22:00 0 10 20 30 40 50 60 70 80 90 100 0:00 2:00 4:00 6:00 8:00 10:00 12:00 14:00 16:00 18:00 20:00 22:00   3   1
  10. 10 −    

  11. 11 − '  ! ) 1 2 3 4

    5 -, #= %( -* ./ +"&$  +" +"
  12. 12   •  $/  •  +-

    %(&1. • 2* )' • 2*#0 )! 2* ", 2* ", 
  13. 13  − '$%*! ' $%# )" 0:00 2:00 4:00

    6:00 8:00 10:00 12:00 14:00 16:00 18:00 20:00 22:00 '&(  !  
  14. 14  − 1 2 3 4 5 $" 

    =   $"  ! $"   # 
  15. 0:00 2:00 4:00 6:00 8:00 10:00 12:00 14:00 16:00 18:00

    20:00 22:00  &  15  −   ! % $#"   &  "
  16. 16   • ! /)-  • 90(,7/)- 

    • $1485 • OS&%"/).  • *3(6' . # +2   # +2
  17. 17         OS

         
  18. 18 

  19. 19  26  • !-4'$ 18 8( • &

    # • &  • ,/ & +)07 *. • & % " 35 •   8( 5( 5( 8( 3(
  20. 20       

  21. 21  • # >:A9; ) %, • (H ID)OS'

    * "0< F: ) %,  &! # •  *45 B/  • $+)(7.45 3 B/ G;ECB/ • ) %,? 61 J-8  • 61 *$  2@:=
  22. 22         

    OS              
  23. 23  https://aws.amazon.com/jp/lambda/pricing/ • *(+.) • ! * • 1,000,000

    $ (' • 1,000,000 $ $0.2  (MB) 1 ('" -)! 100 ),#%& (USD) 128 3,200,000 0.000000208 192 2,133,333 0.000000313 256 1,600,000 0.000000417 AWS Lambda
  24. 24  •  •   

  25. 25    − AWS Lambda Amazon DynamoDB Amazon

    API Gateway Amazon S3 AWS, ./$+( '96172- ! FaaS(Function As a Service)     API 96@F3D>A3;  ! 2B=? )#<: *! E0Web %+ 84  ")& C NoSQL! 2B=5? )#*84 
  26. 26    − AWS IoT Amazon Kinesis Amazon

    Cognito Amazon CloudFront S Akt C A S e S b DAl C N ( S N A o ( ( ) ( ( N vA r n W i l w A
  27. 27       ! 

  28. 28        

  29. 29  • !*3=$ 541!*3< • ( " />7@;6 !*

    2.  90 -OK • #)'+*% &) ,B?: !* 8&) AC
  30. 30     

  31. 31  lLambda 5)%& .#5$ lLambda;1(7,630 lDynamoDB ""4  lLambda

      9 /* AWS ! 8:2 +-' /*
  32. 32        

  33. 33  ;B" AWS0?  4 8<>*# IaaS6 • 

    '3@-%*:D 8. • $,) • $,  • 27$, 1/  9 C 05 • $,&+!( "=A •   8. 5. 5. 8. 3.
  34. 34    

  35. 35    − • IoT' $% " •

    # • !&      IoT' $% "
  36. 36    − SPA <,$ :3Web#(&+ 86.3API*%+4 "'7

    - • ++0 =/ !) Web 12 •  7API5;  9 SPA(Single Page Application)  API
  37. 37    − • $*% 137 &. •

    AWS "; +/0( • #9):8 6, AWS54 !)'-2
  38. 38    

  39. 39     − RDB% "&'$  RDB

     RDB! # 
  40. 40     − • %(5)! •#' &

     "  $
  41.  -"   #(. '$ +! Lambda ,* 41

        −   &*%)   Lambda-"  
  42. 42     •!( @@@@$+ •!( @@ 

    •!( ",)  DL(SPA) •!( AWS'&#-%. •!(    •!(   /* ETC
  43. 43 IoT    

  44. 44 26  • !-4'$ 18 8( • & #

    • &  • ,/ & +)07 *. • & % " 35 •   8( 5( 5( 8( 3(
  45. 45    https://github.com/aws-samples/aws-iot-chat-example/ Demonstration AWS IoT Chat Application

  46. 46  IoT policy IoT Rule AWS Lambda Amazon S3

    Amazon Cloudfront Amazon API Gateway AWS Cognito Amazon DynamoDB Identity Provider
  47. 47  https://www.iwata.classmethod.info/     

  48. 48   l&2479UO l,#B300A/3 l"'*B1A0/3 10604/3N<C> l)!: 5KB(.$ lQ%-62m5.large/

    / FK@ lQ%-62%1F 30GB#- K@ l5?,+/H1R> lMHTJ;S1G= ;S IP 8ELD
  49. 49 ()     Amazon EC2  

     1,440 $0.124/1 $178.56 Amazon EC2  14GB $0.114/1GB $1.596 EBS   60GB $0.12/1  $7.12 :$187.276
  50. 50 ()       AWS IoT

       600  $1.5/100  $7.5 Dynamo DB    10WCU $0.000742/ $5.3424 Dynamo DB !   10RCU $0.0001484/ $1.06848 :$13.91
  51. 51 $187.276 - $13.91 = $173.366  92% 

  52. 52 26  • !-4'$ 18 8( • & #

    • &  • ,/ & +)07 *. • & % " 35 •   8( 5( 5( 8( 3(
  53. 53     •  Lambda • Lambda

       
  54. 54        SAM (Serverless

    Application Model) Serverless Framework APEX  
  55. 55    •  !$(,'  .- 1

    •  '   "# *0)&/+%
  56. 56     SAM CLI LocalStack PostMan DynamoDB

    local AWS BA%&)" *(!"BA?G AWS59 ( .; 7@ *(BA !$/, =8 Web API!"62  ( -4 APIF+ '"1E !"C<0   *(BA DynamoDB%&)" AWS59 ( *(BA AWS:D#%&)"  ( 3 AWS#.; H >
  57. 57  ':, *A? /3  • =7>9B UnitC (

    "();2 • AWS! #, (&-7>+$ * '52 ,*A? 03 /3 • curl%-  Postman;2 • AWS! ' 2 *;2 AWSA? 03 /3 • 18 AWSA?  #,  • .@A?D< 46 E
  58. 58     !  "  $#

     
  59. 59  •#   •"&! •"& $"&  

     % 
  60. 60     98%<+? # #$):&- ):&(,# #$)

    :&430 @. *2 57' !">= 61;1 &  /( ) https://github.com/spulec/moto
  61. 61   ,&10.87 "  (3*$  +) •

    Web  •   • DB  • A  • Lambda1  • B  • Lambda2  • C  2%# %# '546-/!
  62. 62      l(# !"6C ,A-FW$ )

    24 l. 8PJ>/@ :< l%'&*1?3B=; $) 70 FW+  95
  63. 63 04  • !,2'$ /6 8( • & #

    • &  • +- & *).5 • & % " 13 •   8( 5( 5( 8( 3(
  64. 64  & 61 + !"- 8   1

     $5#  *)'7  2  32 ,/(4 0%.  3
  65. 65 ' "& %  !# $ 

  66. 66