Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
aws-lambda-in-practice
Search
tannai
February 20, 2016
Technology
2
1.9k
aws-lambda-in-practice
tannai
February 20, 2016
Tweet
Share
More Decks by tannai
See All by tannai
redash patche at dmm
yuukigoodman
0
680
akibago-2018-10-30
yuukigoodman
0
68
serverless-design-and-streaming-date-processing-service
yuukigoodman
0
870
alexa-changes-development-process
yuukigoodman
0
1.3k
VUIとAlexaによるちょっと未来の体験の話2
yuukigoodman
0
790
regrowth2016alexa
yuukigoodman
0
1.1k
Rails App Deployment with CodeDeploy
yuukigoodman
0
1.3k
cognito-userpools-in-production
yuukigoodman
4
8.4k
serverless-from-today
yuukigoodman
2
2k
Other Decks in Technology
See All in Technology
第3回Snowflake女子会_LT登壇資料(合成データ)_Taro_CCCMK
tarotaro0129
0
180
サイバー攻撃を想定したセキュリティガイドライン 策定とASM及びCNAPPの活用方法
syoshie
3
1.2k
OpenAIの蒸留機能(Model Distillation)を使用して運用中のLLMのコストを削減する取り組み
pharma_x_tech
4
550
PHPからGoへのマイグレーション for DMMアフィリエイト
yabakokobayashi
1
170
LINEスキマニにおけるフロントエンド開発
lycorptech_jp
PRO
0
330
新機能VPCリソースエンドポイント機能検証から得られた考察
duelist2020jp
0
220
How to be an AWS Community Builder | 君もAWS Community Builderになろう!〜2024 冬 CB募集直前対策編?!〜
coosuke
PRO
2
2.8k
AWS re:Invent 2024で発表された コードを書く開発者向け機能について
maruto
0
190
Microsoft Azure全冠になってみた ~アレを使い倒した者が試験を制す!?~/Obtained all Microsoft Azure certifications Those who use "that" to the full will win the exam! ?
yuj1osm
2
110
AWS re:Invent 2024 ふりかえり
kongmingstrap
0
130
終了の危機にあった15年続くWebサービスを全力で存続させる - phpcon2024
yositosi
0
430
MLOps の現場から
asei
6
630
Featured
See All Featured
Building Adaptive Systems
keathley
38
2.3k
Practical Orchestrator
shlominoach
186
10k
We Have a Design System, Now What?
morganepeng
51
7.3k
Navigating Team Friction
lara
183
15k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
229
52k
Fashionably flexible responsive web design (full day workshop)
malarkey
405
66k
Scaling GitHub
holman
458
140k
Facilitating Awesome Meetings
lara
50
6.1k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5.1k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
25k
A Tale of Four Properties
chriscoyier
157
23k
KATA
mclloyd
29
14k
Transcript
%FWFMPQFST*0 -B ୮༏لϞόΠϧΞϓϦαʔϏε෦ Ϋϥεϝιουגࣜձࣾ ⡥$MBTTNFUIPE *OD ݄ ࣮Ͱ͏"84-BNCEB #cmdevio2016
#La
ࣗݾհ • ୮༏ل • Ϋϥεϝιουגࣜձࣾ • ϞόΠϧΞϓϦαʔϏε෦ • αʔόαΠυ୲ 2
#cmdevio2016 #La
ϞόΠϧόοΫΤϯυάϧʔϓ • AWSͱiOS/Androidͷهࣄ͕ଟ͍Classmethod • ࢢͷมԽʹରԠͯ͠αʔόαΠυͷ։ൃ ڧԽ • AWS্Ͱಈ͘APIαʔόWebΞϓϦͷ։ൃ • ্ཱͪ͛ظʹ͖ͭืूதʂ
3 #cmdevio2016 #La
ຊ 4
Agenda • AWS Lambdaͱ࣮ • ࣮ͰͷϢʔεέʔε • LambdaͷTips • ࣮ʹΈࠐΉצॴ
5
AWS Lambdaͱ • https://aws.amazon.com/jp/lambda/faqs/ • ొͨ͠ϓϩάϥϜΛ࣮ߦͯ͘͠ΕΔ ϑϧϚωʔδυαʔϏε • EC2ͷΑ͏ͳཧ͢Βෆཁ •
ϑϧϚωʔδυ • AWSͱͷ࿈ܞ͕ڧྗ • Πϕϯτιʔε 6 #cmdevio2016 #La
࣮ͱ • ࣮ࡍͷ۩ମతͳࣄ • https://kotobank.jp/word/࣮-521746 • ʮΛՌ͓ͨͯۚ͠ΛΒ͏ʯ • ظݶ/είʔϓ/༧ࢉͷ͍͔͕ܾͭ͘·͍ͬͯΔ 7
#cmdevio2016 #La
ͪΐͬͱͰLambdaΛ ͬͨ͜ͱ͕͋Δਓ 8
࣮ͰLambdaΛ ͍ͬͯΔਓ 9
࣮ͰLambdaΛ ͕ͬͭΓ͍ͬͯΔਓ 10
࣮ͰLambdaΛ͏ͷ͍͠ʁ • Lambda͕ྑͦ͞͏ͳ͜ͱ͔Δ • EC2ͰΦϯϓϨͱಉ͡Α͏ʹϓϩάϥϜΛ ࣮ߦ͢Δ͜ͱ͕Ͱ͖ͨ • Lambdaͷ͍ํɺͦΕͱҟͳΔ • ೲظ͕ܾ·͍ͬͯΔͷͰԼखʹϋϚΔͱਏ͍
• ӡ༻࣌ʹ͕ग़ΔͱࠔΔ 11 #cmdevio2016 #La
͜ͷηογϣϯͷΰʔϧ • LambdaΛ࣮Ͱ͏͖͔͚ͬʹͳΔ • ࣮ʹແཧͳ͘औΓೖΕΒΕΔઃܭͷ ͖͔͚ͬΛಘΔ 12 #cmdevio2016 #La
Agenda • AWS Lambdaͱ࣮ • ࣮ͰͷϢʔεέʔε • LambdaͷTips • ࣮ʹΈࠐΉצॴ
13
S3ϑΝΠϧૢ࡞ 14
S3ϑΝΠϧૢ࡞ • ϝλσʔλ༩ • αϜωΠϧ࡞ 15 #cmdevio2016 #La
CSVͷDynamoDBςʔϒϧԽ 16
CSVͷDynamoDBςʔϒϧԽ • S3ʹΞοϓϩʔυ͞ΕͨCSVϑΝΠϧΛ DynamoDBςʔϒϧʹॻ͖ࠐΉFunction • FunctionΛ࣮ߦ͢ΔFunctionͰಉ࣮࣌ߦΛ ੍ޚ 17 #cmdevio2016 #La
CSVͷDynamoDBςʔϒϧԽ 18 #cmdevio2016 #La
CSVͷDynamoDBςʔϒϧԽ • ͱΞϓϦͷػೳͱͯ͠ߟ͍͑ͯͨ • ࣌ؒͷ͔͔ΔॲཧͩͬͨͷͰLambdaԽ • workerͰྑ͔͕ͬͨLambdaͷํ͕ ӡ༻͠ͳͯ͘ྑ͍ͿΜָ 19 #cmdevio2016
#La
ϞόΠϧΞϓϦ͔ΒݺͿAPI 20
ϞόΠϧΞϓϦ͔ΒݺͿAPI • APIαʔό͕୲͍ͬͯͨॲཧΛLambdaͰߦ͏ • DynamoDBʹॻ͖ࠐΉΑΓ༻్͕͍ • ϩδοΫΛޙ͔ΒมߋͰ͖Δ • ηΩϡϦςΟ্ͪΐͬͱ҆৺ 21
#cmdevio2016 #La
ϞόΠϧΞϓϦ͔ΒݺͿAPI 22 #cmdevio2016 #La
ϞόΠϧΞϓϦ͔ΒݺͿAPI 23 #cmdevio2016 #La
ϞόΠϧΞϓϦ͔ΒݺͿAPI • ݁ہɺཁ͕݅ᐆດͳஈ֊ͰLambda࠾༻Λ ܾஅͰ͖ͳ͔ͬͨ • APIαʔόΛNode.jsͰॻ͍ͯਐΊΔ • ཁ͕݅ݻ·ͬͨΓɺLambdaͷػೳ֦ு ΞΫηε͕ݟ௨ͤͨΒLambdaʹ͢Δ ͔͠Εͳ͍
24 #cmdevio2016 #La
σʔλͷऩू 25
σʔλͷऩू • KinesisʹLambdaͰσʔλΛS3ʹஷΊΔ • ஷΊͨσʔλόονͰRDSRedshift • PullܕͰىಈ͢ΔͷͰϨίʔυཧ͕ෆཁ • Lambdaͷػೳ֦ுͱڞʹมԽ 26
#cmdevio2016 #La
σʔλͷऩू 27 Firehoseొલ #cmdevio2016 #La
σʔλͷऩू 28 Firehoseొޙ #cmdevio2016 #La
CloudFormation 29
CloudFormation • https://docs.aws.amazon.com/ja_jp/AWSCloudFormation/latest/UserGuide/ template-custom-resources-lambda.html 30 #cmdevio2016 #La
Agenda • AWS Lambdaͱ࣮ • ࣮ͰͷϢʔεέʔε • LambdaͷTips • ࣮ʹΈࠐΉצॴ
31
όʔδϣχϯάͱΤΠϦΞε 32
όʔδϣχϯάͱΤΠϦΞε • όʔδϣϯ • ಉ͡FunctionͰ൛͝ͱʹมΘΔARN • ΤΠϦΞε • ඥͮ͘όʔδϣϯΛมߋͰ͖ΔARN •
͜ΕΒΛͬͯLambda FunctionΛཧ͢Δ 33 #cmdevio2016 #La
όʔδϣχϯάͱΤΠϦΞε 34 #cmdevio2016 #La
σϓϩΠ 35
σϓϩΠ • ϑΝΠϧΛzipͨ͠ΞϓϦέʔγϣϯόϯυϧ Λ࡞ͬͯΞοϓϩʔυ • Functionຊମ • ґଘϥΠϒϥϦ • aws-sdkaws-cliΛϥοϓ͢Δͱྑ͍
36 #cmdevio2016 #La
σϓϩΠ 37 σϓϩΠύοέʔδʹؚΊΔϥΠϒϥϦͷऔಘ #cmdevio2016 #La
σϓϩΠ 38 σϓϩΠύοέʔδͷΞοϓϩʔυ #cmdevio2016 #La
σϓϩΠ • ϚωδϝϯτίϯιʔϧͰΤΠϦΞεͷΓ ସ͑ 39 #cmdevio2016 #La
ࢹͱϦΧόϦ 40
ࢹͱϦΧόϦ • CloudWatchͰLambdaϝτϦΫεΛݟ͓ͯ͘ • ࣮ߦ݁Ռ͔Βҟৗ͕Θ͔Δͱϕετ • ҟৗ͕͋ͬͨΒϦτϥΠͰ͖ΔΑ͏ʹͯ͠ ͓͘ 41 #cmdevio2016
#La
ࢹͱϦΧόϦ • Lambdaࣗମ͕མͪͨ͜ͱແ͍ • ↑ݸਓͷײͰ͢ • ΞϓϦಉ༷ɺFunctionͷόά͔Βͷෆ۩߹ • ྫ֎Λर͑ͯͳ͔ͬͨɺͳͲ •
࣮ߦ݁Ռ͔Βෆ۩߹Λݕ • ࣄલʹܾΊͨ௨ΓͷϦτϥΠͰରԠ 42 #cmdevio2016 #La
Ϧϛοτ 43
Ϧϛοτ • http://docs.aws.amazon.com/ja_jp/lambda/ latest/dg/limits.html • ࣮༻্ϝϞϦͱಉ࣮࣌ߦͱαΠζʹҙ • ಉظݺͼग़͠ௐ͞ΕΔͱΤϥʔ͕ฦΔ 44 #cmdevio2016
#La
LambdaόοΫΤϯυͷฒྻੑ 45
LambdaόοΫΤϯυͷฒྻੑ • Functionɺฒྻͤ͞ΒΕΔΑ͏ʹॻ͘લఏ • Lambdaࣗମྑ͍͕ɺόοΫΤϯυ͕ͦΕʹ ͑ΒΕͳ͍Մೳੑ͕͋Δ 46 #cmdevio2016 #La
LambdaόοΫΤϯυͷฒྻੑ • ରࡦ1: εέʔϥϒϧͳόοΫΤϯυΛ͏ • DynamoDB • ରࡦ2: ฒྻΛ੍ޚ͢ΔΈΛೖΕΔ •
FunctionΛىಈ͢ΔFunctionΛઃ͚Δ 47 #cmdevio2016 #La
Lambdaͷඅ༻ 48
Lambdaͷඅ༻ • Lambdaࣗମ֨҆ͩ͠ɺແྉ͕େ͖͍ • AWSτʔλϧͰͷࢼࢉΛ͓͖ͯ͘͠ • ࣮ࡍͷෛՙΛ͔͚ͯྉۚͷ্͕ΓํΛݟΔ 49 #cmdevio2016 #La
Lambdaͷඅ༻ • CloudWatch Logsͷ߹ • FunctionͰඪ४ग़ྗͨ͠༰͕Logsʹ อଘ͞Εͯɺͦ͜Ͱͷ՝͕ۚൃੜ͢Δ • DynamoDBͷ߹ •
ΩϟύγςΟ͑Λ͙߹ଟΊʹઃఆ ͢Δඞཁ͕͋Γɺͦ͜Ͱ՝͕ۚൃੜ͢Δ 50 #cmdevio2016 #La
Agenda • AWS Lambdaͱ࣮ • ࣮ͰͷϢʔεέʔε • LambdaͷTips • ࣮ʹΈࠐΉצॴ
51
ͲͷॲཧΛLambdaʹ͢Δ͔ 52
Lambdaʹ͢Δॲཧ • ϏδωεϩδοΫҎ֎Λସ͢Δ߹ • ϏδωεϩδοΫΛସ͢Δ߹ • ӡ༻ิॿͰ͏߹ • ఘΊΔ߹ 53
#cmdevio2016 #La
ϏδωεϩδοΫҎ֎Λସ͢Δ߹ • αϜωΠϧ࡞ɺϑΥʔϚοτมͳͲ • ΞϓϦέʔγϣϯͷҡ࣋ʹෆՄܽͳػೳ • LambdaԽ͍͢͠ॲཧ • LambdaԽͷԸܙΛड͚͍͢ 54
#cmdevio2016 #La
ϏδωεϩδοΫΛସ͢Δ߹ • ैདྷAPIαʔό͕ߦ͍ͬͯͨॲཧΛସ͢Δ • Ұ൪ߴίετͳ෦͕ղܾ͢Δ • ཁ݅ʹΑ͔ͬͯͬͨ͠Γ͢Δ • CognitoAPIGWΛซ༻͢Δ 55
#cmdevio2016 #La
ӡ༻ิॿͰ͏߹ • CloudFormationͷΧελϜϦιʔεɺcronͷ ସͳͲ • ෆ۩߹࣌ൺֱతΧόʔ͍͢͠ͷͰಋೖ͠ ͍͔͢͠Εͳ͍ 56 #cmdevio2016 #La
ఘΊΔ߹ • ࣮ͰϏδωεͷޭ͕༏ઌ͞ΕΔ͜ͱ͕ଟ͍ • ແཧʹ͓͏ͱ͠ͳ͍ • Lambdaʹͩ͜ΘͬͯϏδωε͕ࣦഊͨ͠Β • ຊస •
ఫୀ͢Δͱ͖ʹLambdaԽͷ༨Λ͢ • LambdaରԠݴޠͰബ͍APIαʔό • όοΫΤϯυʹDynamoDB 57 #cmdevio2016 #La
ͲͷॲཧΛLambdaԽ͢Δ͔ • ӡ༻ิॿ͔ΒॳΊͯɺϏδωεϩδοΫҎ֎ ͷସΛࢦ͢ͷ͕ྑͦ͞͏ • ΞϓϦͷସͱͯ͠͏ͷෑډ͕ߴ͍ • Ϗδωεߟྀ͢Δͱঘྑ͠ 58 #cmdevio2016
#La
ෆ҆ʹඋ͑Δ 59
ෆ҆ʹඋ͑Δ • ࣦഊΛϋϯυϦϯάͰ͖Δͱ͜ΖͰߦ͏ • ӡ༻ٕज़ͷηΧϯμϦ • ࠷ॳLambdaͷସखஈΛߟ͓͑ͯ͘ • ࢹͱτϥϒϧ࣌ͷ෮چखஈΛΕͳ͍ 60
#cmdevio2016 #La
61 44 44 ཧςʔϒϧ σʔλςʔϒϧ ςʔϒϧ໊ ૯ ࣮ classmethod.jp
62 45 45 ཧςʔϒϧ σʔλςʔϒϧ ςʔϒϧ໊ ૯ ࣮ ͋Β͔͡ΊσʔλςʔϒϧΛ࡞͠ VTFS@JE
OBNF TDPSF EBUB XSJUFશৼΓ classmethod.jp
63 46 46 ཧςʔϒϧ σʔλςʔϒϧ ςʔϒϧ໊ ૯ ࣮ ॲཧྔ $47ϑΝΠϧͷߦ
ΛಡΈࠐΈ VTFS@JE OBNF TDPSF EBUB XSJUFશৼΓ classmethod.jp
64 47 47 ཧςʔϒϧ σʔλςʔϒϧ ςʔϒϧ໊ ૯ ࣮ EBUB
VTFS@JE OBNF TDPSF ཧςʔϒϧʹ ૯Λొ͓ͯ͘͠ EBUB XSJUFશৼΓ classmethod.jp
65 48 48 ཧςʔϒϧ σʔλςʔϒϧ ςʔϒϧ໊ ૯ ࣮ EBUB
VTFS@JE OBNF TDPSF BCDE σʔλΛ֨ೲͨ͠Β EBUB XSJUFશৼΓ classmethod.jp
66 49 49 ཧςʔϒϧ σʔλςʔϒϧ ςʔϒϧ໊ ૯ ࣮ EBUB
VTFS@JE OBNF TDPSF BCDE ΧϯλΛՃࢉ ΞτϛοΫΧϯλ EBUB XSJUFશৼΓ classmethod.jp
67 50 50 ཧςʔϒϧ σʔλςʔϒϧ ςʔϒϧ໊ ૯ ࣮ EBUB
VTFS@JE OBNF TDPSF BCDE FGHI σʔλΛ֨ೲͨ͠Β EBUB XSJUFશৼΓ classmethod.jp
68 51 51 ཧςʔϒϧ σʔλςʔϒϧ ςʔϒϧ໊ ૯ ࣮ EBUB
VTFS@JE OBNF TDPSF BCDE FGHI ΧϯλΛՃࢉ ΞτϛοΫΧϯλ EBUB XSJUFશৼΓ classmethod.jp
69 52 52 ཧςʔϒϧ σʔλςʔϒϧ ςʔϒϧ໊ ૯ ࣮ EBUB
VTFS@JE OBNF TDPSF BCDE FGHI શͯͷޭΛ֬ೝͨ͠Β EBUB XSJUFશৼΓ classmethod.jp
70 53 53 ཧςʔϒϧ σʔλςʔϒϧ ςʔϒϧ໊ ૯ ࣮ EBUB
VTFS@JE OBNF TDPSF BCDE FGHI SFBEશৼΓʹ͢Δ EBUB SFBEશৼΓ classmethod.jp
71 55 55 ཧςʔϒϧ σʔλςʔϒϧ ςʔϒϧ໊ ૯ ࣮ EBUB
VTFS@JE OBNF TDPSF BCDE ࣦ͠ഊͨ͠Β EBUB XSJUFશৼΓ '"*-&% 9 classmethod.jp
72 56 56 ཧςʔϒϧ σʔλςʔϒϧ ςʔϒϧ໊ ૯ ࣮ EBUB
VTFS@JE OBNF TDPSF BCDE Ұக͠ͳ͍ͷͰ EBUB XSJUFશৼΓ 㱠 '"*-&% classmethod.jp
73 57 57 ཧςʔϒϧ σʔλςʔϒϧ ςʔϒϧ໊ ૯ ࣮ EBUB
EBUB શͯ࡞Γ͢ VTFS@JE OBNF TDPSF EBUB XSJUFશৼΓ classmethod.jp
มԽʹඋ͑Δ 74
LambdaػೳՃͷྺ࢙ • 2015/04/09 Ұൠެ։ • 2015/05/28 σϓϩΠύοέʔδͷS3ରԠ • 2015/06/15 JavaରԠ
• 2015/07/09 APIGWରԠ • 2015/07/14 DynamoDB StreamsҰൠެ։ • 2015/10/08 Pythonɺόʔδϣϯɺ5ɺcron • 2016/02/11 VPCରԠ 75 http://aws.amazon.com/releasenotes/AWS-Lambda?browse=1 #cmdevio2016 #La
มԽʹඋ͑Δ • LambdaͷػೳՃεϐʔυ͍ • ৽ػೳͰطଘΞϓϦΛLambdaʹ Γग़ͨ͠ΓɺLambdaΛݮΒ͠ଓ͚Δ • ΞϓϦຊମͷςετྑ͍ઃܭΛҡ࣋͢Δ 76 #cmdevio2016
#La
77 Before After #cmdevio2016 #La
·ͱΊ 78
·ͱΊ • ͱΓ࣮͋͑ͣʹऔΓೖΕͯΈΑ͏ • ϏδωεΛՃͤ͞Δ͍ํΛ͠Α͏ • ͜ͷձͰ૬ஊ͠Α͏ • 3FΞʔΩςΫςΟϯά •
3F͓Έ૬ஊࣨ • ࠙ձ 79 #cmdevio2016 #La
80
None