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
Amplify Gen2 Deep Dive / バックエンドの型をいかにしてフロントエンドへ伝えるか #TSKaigi #TSKaigiKansai #AWSAmplifyJP
tacck
PRO
0
390
Oracle Cloud Infrastructureデータベース・クラウド:各バージョンのサポート期間
oracle4engineer
PRO
28
13k
AIチャットボット開発への生成AI活用
ryomrt
0
170
アプリエンジニアのためのGraphQL入門.pdf
spycwolf
0
100
AWS Media Services 最新サービスアップデート 2024
eijikominami
0
200
Engineer Career Talk
lycorp_recruit_jp
0
190
生成AIが変えるデータ分析の全体像
ishikawa_satoru
0
170
アジャイルチームがらしさを発揮するための目標づくり / Making the goal and enabling the team
kakehashi
3
150
データプロダクトの定義からはじめる、データコントラクト駆動なデータ基盤
chanyou0311
2
330
OS 標準のデザインシステムを超えて - より柔軟な Flutter テーマ管理 | FlutterKaigi 2024
ronnnnn
1
280
日経電子版のStoreKit2フルリニューアル
shimastripe
1
140
SSMRunbook作成の勘所_20241120
koichiotomo
3
160
Featured
See All Featured
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
109
49k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
250
21k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
25
1.8k
The MySQL Ecosystem @ GitHub 2015
samlambert
250
12k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
Raft: Consensus for Rubyists
vanstee
136
6.6k
Unsuck your backbone
ammeep
668
57k
Visualization
eitanlees
145
15k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
42
9.2k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
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 IUUQTEFW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^ DBMMCBDL ‣ 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ศརʂ