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

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

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

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

TomoyaIwata

October 05, 2018
Tweet

More Decks by TomoyaIwata

Other Decks in Technology

Transcript

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

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

    (C/S+LAMP+) l"%AWS$-3 l2*  , 04
  3. 5  26  • !-4'$ 18 8( • &

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

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

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

     1" 2" 3" 4" 5" &#' (,  +  (,
  7. 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
  8. 11 − '  ! ) 1 2 3 4

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

    %(&1. • 2* )' • 2*#0 )! 2* ", 2* ", 
  10. 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 '&(  !  
  11. 14  − 1 2 3 4 5 $" 

    =   $"  ! $"   # 
  12. 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  −   ! % $#"   &  "
  13. 16   • ! /)-  • 90(,7/)- 

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

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

    # • &  • ,/ & +)07 *. • & % " 35 •   8( 5( 5( 8( 3(
  16. 21  • # >:A9; ) %, • (H ID)OS'

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

    OS              
  18. 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
  19. 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 
  20. 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
  21. 29  • !*3=$ 541!*3< • ( " />7@;6 !*

    2.  90 -OK • #)'+*% &) ,B?: !* 8&) AC
  22. 33  ;B" AWS0?  4 8<>*# IaaS6 • 

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

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

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

    AWS "; +/0( • #9):8 6, AWS54 !)'-2
  26.  -"   #(. '$ +! Lambda ,* 41

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

    •!( ",)  DL(SPA) •!( AWS'&#-%. •!(    •!(   /* ETC
  28. 44 26  • !-4'$ 18 8( • & #

    • &  • ,/ & +)07 *. • & % " 35 •   8( 5( 5( 8( 3(
  29. 46  IoT policy IoT Rule AWS Lambda Amazon S3

    Amazon Cloudfront Amazon API Gateway AWS Cognito Amazon DynamoDB Identity Provider
  30. 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
  31. 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
  32. 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
  33. 52 26  • !-4'$ 18 8( • & #

    • &  • ,/ & +)07 *. • & % " 35 •   8( 5( 5( 8( 3(
  34. 54        SAM (Serverless

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

    •  '   "# *0)&/+%
  36. 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 >
  37. 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
  38. 60     98%<+? # #$):&- ):&(,# #$)

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

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

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

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

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