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.7k
さぁ!今すぐプロジェクトリーダーに立候補しよう / Be a Project Leader
kakakakakku
3
8.9k
プロジェクトをリードする技術 (Kyash 社 再演) / Project Leading is Skill for Kyash
kakakakakku
4
2.1k
プロジェクトをリードする技術 / 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
組織に自動テストを書く文化を根付かせる戦略(2024冬版) / Building Automated Test Culture 2024 Winter Edition
twada
PRO
17
4.8k
KubeCon NA 2024 Recap: How to Move from Ingress to Gateway API with Minimal Hassle
ysakotch
0
210
Oracle Cloud Infrastructure:2024年12月度サービス・アップデート
oracle4engineer
PRO
0
210
ずっと昔に Star をつけたはずの思い出せない GitHub リポジトリを見つけたい!
rokuosan
0
150
1等無人航空機操縦士一発試験 合格までの道のり ドローンミートアップ@大阪 2024/12/18
excdinc
0
170
20241220_S3 tablesの使い方を検証してみた
handy
4
630
MLOps の現場から
asei
7
650
複雑性の高いオブジェクト編集に向き合う: プラガブルなReactフォーム設計
righttouch
PRO
0
120
バクラクのドキュメント解析技術と実データにおける課題 / layerx-ccc-winter-2024
shimacos
2
1.1k
終了の危機にあった15年続くWebサービスを全力で存続させる - phpcon2024
yositosi
19
18k
APIとはなにか
mikanichinose
0
100
GitHub Copilot のテクニック集/GitHub Copilot Techniques
rayuron
37
15k
Featured
See All Featured
Making Projects Easy
brettharned
116
5.9k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
RailsConf 2023
tenderlove
29
940
Art, The Web, and Tiny UX
lynnandtonic
298
20k
Site-Speed That Sticks
csswizardry
2
190
Measuring & Analyzing Core Web Vitals
bluesmoon
4
170
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Become a Pro
speakerdeck
PRO
26
5k
Documentation Writing (for coders)
carmenintech
66
4.5k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
1.2k
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
ʘ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DBMMCBDL ‣ -BNCEB'VODUJPOͰΠϕϯτ͝ͱʹॲཧΛذ͍ͯ͠Δ ‣ \BDUJPOlTUBSU^ˠΠϯελϯεىಈ ‣ \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ศརʂ