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

AWS SAM でLambda開発

AWS SAM でLambda開発

6ab47a68ee78e84c34731ce12333deff?s=128

虎の穴ラボ株式会社

February 19, 2019
Tweet

More Decks by 虎の穴ラボ株式会社

Other Decks in Programming

Transcript

  1. ) ( ) ( ) ( ) ( ) (

    ) ( Copyright (C) 2019 Toranoana Inc. All Rights Reserved. AWS SAM Lambda-% 2019/02/19   "! * ,  .& $' ) ( ) ( +# 
  2. . + . + . + . + . +

    . + Copyright (C) 2019 Toranoana Inc. All Rights Reserved. -#, 3/%) ! 1 2 *32018$4' " 3  ( &3  0 2
  3.        Copyright (C) 2019

    Toranoana Inc. All Rights Reserved.  • AWS SAM • AWS SAM  • template.yaml •  •  3
  4.          

      Copyright (C) 2019 Toranoana Inc. All Rights Reserved.  •      • Lambda  4
  5. * ( * ( * ( * ( * (

    * ( Copyright (C) 2019 Toranoana Inc. All Rights Reserved. AWS SAM  • AWS $$!$#  (AWS SAM) • AWS $$!$ #&) %'  $#$!$"$ 5
  6. ! ! ! ! !  ! Copyright (C) 2019

    Toranoana Inc. All Rights Reserved. AWS SAM  … •  "… • AWS … • Lambda"… • … • … • … 6
  7. ) ( ) ( ) ( ) ( ) (

    ) ( Copyright (C) 2019 Toranoana Inc. All Rights Reserved. AWS SAM… • '$!, • +&, • , •  *#, • % " , 7
  8.        Copyright (C) 2019

    Toranoana Inc. All Rights Reserved.     8
  9.        Copyright (C) 2019

    Toranoana Inc. All Rights Reserved. AWS SAM         9
  10.        Copyright (C) 2019

    Toranoana Inc. All Rights Reserved.  • AWSCLISAM CLI  • Docker   • Lambda  python3.6 10
  11.       Copyright (C) 2019 Toranoana

    Inc. All Rights Reserved. AWS CLISAM CLI 11 AWS CLI macOS https://docs.aws.amazon.com/ja_jp/cli/latest/userguide/install- macos.html SAM CLI macOS https://docs.aws.amazon.com/ja_jp/serverless-application- model/latest/developerguide/serverless-sam-cli-install- mac.html Docker     
  12.       Copyright (C) 2019 Toranoana

    Inc. All Rights Reserved.   (sam init) sam init --runtime python3.6 12
  13.        Copyright (C) 2019

    Toranoana Inc. All Rights Reserved.       13
  14.        Copyright (C) 2019

    Toranoana Inc. All Rights Reserved. SAM     14
  15.        Copyright (C) 2019

    Toranoana Inc. All Rights Reserved. SAM     sam local start-api 15
  16.        Copyright (C) 2019

    Toranoana Inc. All Rights Reserved. SAM     (curl) hello world  curl http://127.0.0.1:3000/hello 16
  17.        Copyright (C) 2019

    Toranoana Inc. All Rights Reserved. Docker  SAM     17 API Gatewa Lambda
  18. " ! " ! " ! " ! " !

    " ! Copyright (C) 2019 Toranoana Inc. All Rights Reserved. SAM     • sam-app   •   (message  ) 18
  19.        Copyright (C) 2019

    Toranoana Inc. All Rights Reserved. SAM     jq   19
  20.        Copyright (C) 2019

    Toranoana Inc. All Rights Reserved. SAM CLI  • S3  AWS CLI aws s3 mb s3://<bucketname> 20
  21.       Copyright (C) 2019 Toranoana

    Inc. All Rights Reserved. SAM CLI  pip install python3 -m venv .venv . .venv/bin/activate pip install -r requirements.txt -t ./ 21
  22.        Copyright (C) 2019

    Toranoana Inc. All Rights Reserved. SAM CLI       sam package --template-file template.yaml --output-template-file packaged-template.yaml --s3-bucket tora-alexa-skill sam deploy --template-file packaged-template.yaml --stack-name TestStack --capabilities CAPABILITY_IAM   22
  23. % $ % $ % $ % $ % $

    % $ Copyright (C) 2019 Toranoana Inc. All Rights Reserved. template.yaml • AWS SAM '! •   # " '!    →(& 23
  24.        Copyright (C) 2019

    Toranoana Inc. All Rights Reserved.      Cloud Formation  24
  25.        Copyright (C) 2019

    Toranoana Inc. All Rights Reserved.    Lambda   25
  26.        Copyright (C) 2019

    Toranoana Inc. All Rights Reserved.    LambdaAPI Gateway   26
  27.        Copyright (C) 2019

    Toranoana Inc. All Rights Reserved.      API  27 curl https://hbobnl3k92.execute-api.ap-northeast-1.amazonaws.com/Prod/hello
  28. 8 6 8 6 8 6 8 6 8 6

    8 6 Copyright (C) 2019 Toranoana Inc. All Rights Reserved.  • ,",)#',&+ + #(-3 #*59 %+!29  • template.yaml:1 ', $+ -3  • 7/ 0 -; • AWS SAM. 4 ; 28