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
Lambda + Apex 事例紹介 ~ 全ては AWS コスト削減のために ~ / Case...
Search
Yoshiaki Yoshida
March 10, 2017
Technology
2
6.2k
Lambda + Apex 事例紹介 ~ 全ては AWS コスト削減のために ~ / Case Study of Lambda and Apex
Lambda + Apex 事例紹介
~ 全ては AWS コスト削減のために ~
Yoshiaki Yoshida
March 10, 2017
Tweet
Share
More Decks by Yoshiaki Yoshida
See All by Yoshiaki Yoshida
技術ブロガーを育てる!ブログメンタリングで何を教えているのか / Passion for Blog Mentoring
kakakakakku
8
36k
プログラミング初心者に教えるときは「身近な比喩」が重要なのだ! / Metaphor is Important for Beginner Programmer
kakakakakku
2
5.5k
プロジェクトの成功を支える ZenHub と モブプログラミング / ZenHub and Mob Programming
kakakakakku
1
5.7k
楽しく!アウトプットを習慣化しよう / Let's Enjoy Output
kakakakakku
3
6.6k
さぁ!今すぐプロジェクトリーダーに立候補しよう / Be a Project Leader
kakakakakku
3
8.9k
プロジェクトをリードする技術 (Kyash 社 再演) / Project Leading is Skill for Kyash
kakakakakku
4
2k
プロジェクトをリードする技術 / Project Leading is Skill
kakakakakku
43
46k
Mackerel で ECS をどこまでモニタリングできるのか / Monitoring ECS with Mackerel
kakakakakku
0
13k
[2018/01/30] Redash 初心者向けハンズオン / Redash Meetup #0.1
kakakakakku
0
2.3k
Other Decks in Technology
See All in Technology
BLADE: An Attempt to Automate Penetration Testing Using Autonomous AI Agents
bbrbbq
0
300
The Rise of LLMOps
asei
7
1.4k
iOSチームとAndroidチームでブランチ運用が違ったので整理してます
sansantech
PRO
0
130
TypeScriptの次なる大進化なるか!? 条件型を返り値とする関数の型推論
uhyo
2
1.6k
Lexical Analysis
shigashiyama
1
150
透過型SMTPプロキシによる送信メールの可観測性向上: Update Edition / Improved observability of outgoing emails with transparent smtp proxy: Update edition
linyows
2
210
スクラム成熟度セルフチェックツールを作って得た学びとその活用法
coincheck_recruit
1
140
インフラとバックエンドとフロントエンドをくまなく調べて遅いアプリを早くした件
tubone24
1
430
AGIについてChatGPTに聞いてみた
blueb
0
130
適材適所の技術選定 〜GraphQL・REST API・tRPC〜 / Optimal Technology Selection
kakehashi
1
170
ハイパーパラメータチューニングって何をしているの
toridori_dev
0
140
強いチームと開発生産性
onk
PRO
34
11k
Featured
See All Featured
Art, The Web, and Tiny UX
lynnandtonic
297
20k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.3k
Building an army of robots
kneath
302
43k
Building Applications with DynamoDB
mza
90
6.1k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
6.9k
Gamification - CAS2011
davidbonilla
80
5k
Facilitating Awesome Meetings
lara
50
6.1k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
BBQ
matthewcrist
85
9.3k
Transcript
-BNCEB "QFYࣄྫհ dશͯ"84ίετݮͷͨΊʹd !LBLBLBLBLLV ࣾษڧձ
:PTIJBLJ:PTIJEB !LBLBLBLBLLV ‣ .BLVBLF$ZCFS"HFOU$SPXE'VOEJOH *OD ‣ 8FC0QFSBUJPOT&OHJOFFSٕ݉ज़ใ ‣ "84 3VCZ
$FSUJpFE4DSVN.BTUFS ‣ ϓϩάϥϛϯάߨࢣͷࣄΛ࢝Ί·ͨ͠ ‣ IUUQLBLBLBLBLLVIBUFOBCMPHDPN
ʘ࠷ۙ$ZCFS"HFOU%FWFMPQFST#MPHʹهࣄग़ͯ͠·͢ʗ IUUQTEFWFMPQFSTDZCFSBHFOUDPKQCMPHBSDIJWFT IUUQTEFWFMPQFSTDZCFSBHFOUDPKQCMPHBSDIJWFT
ʘϙουΩϟετσϏϡʔ͠·ͨ͠ʗ IUUQMFBOBHJMFGNFQJTPEF
None
"84-BNCEB ͬͯ·͔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OlTUBSU^ˠΠϯελϯεىಈ ‣ \BDUJPOlTUPQ^ˠΠϯελϯεఀࢭ QBSBNTʹ*OTUBODF*ETΛઃఆͯ͠ ෳΠϯελϯεΛૢ࡞͢Δ
-BNCEB $MPVE8BUDI &WFOUT DSPO࣮ߦ &$ &$ &$ TUBSUTUPQ ϝϯςφϯεPOPGG <࣮ߦϑϩʔ>
"84$MPVE8BUDI&WFOUT ϞχλϦϯά ͚ͩ͡Όͳ͍Αʁ
εέδϡʔϦϯά࣮ߦ ‣ +FOLJOT͍ͨ͠ ‣ "84$MPVE8BUDI&WFOUT ‣ DSPOࣜͰઃఆͨ͠εέδϡʔϦϯάͰ-BNCEBΛىಈͰ͖Δ ‣ ཁҙϙΠϯτ ‣
DSPOࣜ ‣ 65$લఏ
DSPOࣜ ݄༵࣌ؒ .0/'3* ΤϥʔʹͳΔ ยํΛ ʹ͢Δඞཁ͕͋Δ
65$લఏ ຊ࣌ؒlՐਫۚz TUPQ*OTUBODFT
.PO 5VF 5IV 8FE 'SJ 4BU 4VO
65$લఏ .0/'3* ײతʹཧղ͠ʹ͍͘ ຊ࣌ؒlՐਫۚz TUPQ*OTUBODFT
-BNCEB $MPVE8BUDI &WFOUT DSPO࣮ߦ &$ &$ &$ TUBSUTUPQ ϝϯςφϯεPOPGG <࣮ߦϑϩʔ>
"84-BNCEB Ͳ͏ͬͯ σϓϩΠ͢Δʁ
-BNCEB $MPVE8BUDI &WFOUT DSPO࣮ߦ &$ &$ &$ TUBSUTUPQ ϝϯςφϯεPOPGG NFSHF
IPPL BQFYEFQMPZ <࣮ߦϑϩʔ> <σϓϩΠϑϩʔ>
None
"QFY ‣ -BNCEBཧπʔϧʢϏϧυˍσϓϩΠʣ ‣ ؔ࿈4FSWFSMFTT'SBNFXPSL -BNWFSZ "844".ͳͲ ‣ -BNCEBʹಛԽ͍ͯ͠ΔͨΊඇৗʹബ࣮͘͞Ε͍ͯΔ ‣
υΩϡϝϯτॆ࣮͍ͯ͠Δ ‣ 5FSSBGPSN࿈ܞ ‣ ABQFYJOGSBAίϚϯυAUFSSBGPSNAίϚϯυͷϥούʔ
"QFYίϚϯυհ ‣ BQFYJOJUॳظԽ͢Δʢ*".3PMFͱ*".1PMJDZͷࣗಈੜؚΉʣ ‣ BQFYEFQMPZ-BNCEB'VODUJPOΛσϓϩΠ͢Δ ‣ BQFYJOWPLF-BNCEB'VODUJPOΛ࣮ߦ͢Δ ‣ BQFYMPHT G
$MPVE8BUDI-PHTΛ֬ೝ͢Δ ‣ BQFYEPDTυΩϡϝϯτΛࢀর͢Δ
{ "name": "project-name", "description": "project-name", "memory": 128, "timeout": 300, "role":
"", "environment": { "DEBUG_SHIM": "true" } } "QFYઃఆϑΝΠϧ project.json -BNCEB'VODUJPOͷϝϞϦͱλΠϜΞτઃఆͰ͖Δ
"QFYઃఆϑΝΠϧ { "name": "project-name", "description": "project-name", "memory": 128, "timeout": 300,
"role": "", "environment": { "DEBUG_SHIM": "true" } "hooks": { "build": "cp ../../package.json . && npm install" } } project.json OQNϥΠϒϥϦΛؚΊΔ͜ͱͰ͖Δ
$JSDMF$*͔ΒσϓϩΠ͢Δ machine: timezone: Asia/Tokyo dependencies: post: - curl https://raw.githubusercontent.com/apex/ apex/master/install.sh
| sudo sh deployment: master: branch: master commands: - apex deploy test: pre: - npm install eslint --save-dev override: - ./node_modules/.bin/eslint . circle.yml NBTUFSʹϚʔδ͞ΕͨΒ ࣗಈతʹσϓϩΠ͢Δ &4-JOUΛ ࣮ߦ͢Δ
-BNCEB $MPVE8BUDI &WFOUT DSPO࣮ߦ &$ &$ &$ TUBSUTUPQ ϝϯςφϯεPOPGG NFSHF
IPPL BQFYEFQMPZ <࣮ߦϑϩʔ> <σϓϩΠϑϩʔ>
ؾ͖·ͨ͠ʁ
-BNCEB $MPVE8BUDI &WFOUT DSPO࣮ߦ &$ &$ &$ TUBSUTUPQ ϝϯςφϯεPOPGG NFSHF
IPPL BQFYEFQMPZ <࣮ߦϑϩʔ> <σϓϩΠϑϩʔ> 4FSWFSMFTT "SDIJUFDUVSF
ͬͱৄ͘͠ʂ
BQFYBQFY
BQFYBQFY
BQFYBQFY
XJUI(PTVQQPSU
-BNCEBαϙʔτݴޠ ‣ /PEFKT ‣ +BWB ‣ 1ZUIPO ‣ $ SF*OWFOUͰ
3VCZͱ(PMBOHαϙʔτͷ ൃද͕ແͯ͘ ΨοΧϦͨ͠ਓଟ͍Ͱ͠ΐ͏
JOEFYKTΛಡΜͩ
var child = require('child_process') var byline = require('./byline') /** *
Callback for the request. */ var callback /** * Child process for binary I/O. */ var proc = child.spawn('./main', { stdio: ['pipe', 'pipe', process.stderr] }) proc.on('error', function(err){ console.error('[shim] error: %s', err) process.exit(1) }) proc.on('exit', function(code, signal){ console.error('[shim] exit: code=%s signal=%s', code, signal) process.exit(1) }) index.js ࢠϓϩηεͰ (P NBJO Λಈ͔ͯ͠ ϓϩηεؒ௨৴Λ͢Δ ඪ४ೖྗ TUEJO ඪ४ग़ྗ TUEPVU ඪ४Τϥʔग़ྗ TUEFSS
/** * Newline-delimited JSON stdout. */ var out = byline(proc.stdout)
out.on('data', function(line){ if (process.env.DEBUG_SHIM) console.log('[shim] parsing: `%s`', line) var msg = JSON.parse(line) callback(msg.error, msg.value) }) /** * Handle events. */ exports.handle = function(event, ctx, cb) { callback = cb ctx.callbackWaitsForEmptyEventLoop = false proc.stdin.write(JSON.stringify({ "event": event, "context": ctx })+'\n'); } index.js (Pͷඪ४ग़ྗΛฦ͢ \ ʢதུʣ FOWJSPONFOU\ %(@4)*.USVF ^ ^ ։ൃதσόοάϞʔυ ʹ͓ͯ͘͠ͱศར
؆ུԽ͢Δͱ
JOEFYKT BQFYTIJN NBJOHP 45%*/ 45%065 JOWPLF DIJME@QSPDFTTTQBXO 45%&33
Ͳ͏ͯ͠-BNCEBͰ (PΛಈ͔͍ͨ͠ͳΒ͑Δ͔ʁ ʢެࣜαϙʔτΛͬͯྑͦ͞͏ʣ
"845JQTհ ࣌ؒ༨ͬͨΒ
BXTMPHT $MPVE8BUDI-PHTΛ؆୯ʹॲཧͰ͖Δ$-* ʢϑΟϧλ Υον ࣌ࢦఆͳͲʣ
HJUTFDSFUT *".ΫϨσϯγϟϧͷޡίϛοτΛࢭ͢Δπʔϧ ʢҰݴͰݴ͑HJUIPPLTʣ
SPBEXPSLFS 3PVUFͷઃఆΛ*OGSBTUSVDUVSFBT$PEFԽ͢Δ ʢݸਓυϝΠϯͷཧʹͬͯΔʣ
QJDVMFU ηΩϡϦςΟάϧʔϓΛ*OGSBTUSVDUVSFBT$PEFԽ͢Δ
·ͱΊ
-BNCEB "QFYศརʂ