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
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
podman_update_2024-12
orimanabu
1
270
AWS re:Invent 2024で発表された コードを書く開発者向け機能について
maruto
0
190
多領域インシデントマネジメントへの挑戦:ハードウェアとソフトウェアの融合が生む課題/Challenge to multidisciplinary incident management: Issues created by the fusion of hardware and software
bitkey
PRO
2
100
re:Invent 2024 Innovation Talks(NET201)で語られた大切なこと
shotashiratori
0
310
継続的にアウトカムを生み出し ビジネスにつなげる、 戦略と運営に対するタイミーのQUEST(探求)
zigorou
0
530
5分でわかるDuckDB
chanyou0311
10
3.2k
大幅アップデートされたRagas v0.2をキャッチアップ
os1ma
2
530
レンジャーシステムズ | 会社紹介(採用ピッチ)
rssytems
0
150
PHPからGoへのマイグレーション for DMMアフィリエイト
yabakokobayashi
1
170
複雑性の高いオブジェクト編集に向き合う: プラガブルなReactフォーム設計
righttouch
PRO
0
110
alecthomas/kong はいいぞ / kamakura.go#7
fujiwara3
1
300
プロダクト開発を加速させるためのQA文化の築き方 / How to build QA culture to accelerate product development
mii3king
1
260
Featured
See All Featured
Building an army of robots
kneath
302
44k
Become a Pro
speakerdeck
PRO
26
5k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
2
290
Why Our Code Smells
bkeepers
PRO
335
57k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
YesSQL, Process and Tooling at Scale
rocio
169
14k
The Language of Interfaces
destraynor
154
24k
How GitHub (no longer) Works
holman
311
140k
Raft: Consensus for Rubyists
vanstee
137
6.7k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
44
9.3k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
95
17k
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 IUUQTEFWFMPQFSTDZCFSBH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TUPQ*OTUBODFT
QBSBNT\^ 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ศརʂ