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
LT_Cloud_Functions.pdf
Search
Masaki Iino
September 08, 2017
Technology
1
550
LT_Cloud_Functions.pdf
社内LT用
Masaki Iino
September 08, 2017
Tweet
Share
More Decks by Masaki Iino
See All by Masaki Iino
GCP Composer
iinomasaki
0
230
AnyPay ChatOps
iinomasaki
0
1.2k
Istio
iinomasaki
0
1.6k
GolangでAPIドキュメント自動生成
iinomasaki
0
620
Other Decks in Technology
See All in Technology
Passkey Autofill に賭けるマネーフォワード ID - Money Forward Tech Day 2024
nov
0
200
JTCや セキュリティチェックリストが夢の跡
nikinusu
1
800
【株式会社ELYZA】|GENIAC成果報告会 自社開発モデルプレゼンテーション
elyza
1
410
LINEヤフーのフロントエンド組織・体制の紹介
lycorp_recruit_jp
1
1.2k
可視化により内部品質をあげるAIドキュメントリバース/20240910 Hiromitsu Akiba
shift_evolve
0
230
20240911_New_Relicダッシュボード活用例
speakerdeckfk
0
110
Segment Anything Model 2
tenten0727
3
720
どこよりも遅めなWinActor Ver.7.5.0 新機能紹介
tamai_63
0
210
2ヶ月かかるDBアップグレード検証を最大2週間に短縮した自作Go製CLIツール「Platinum」を紹介する / Introducing Go CLI tool "Platinum" for shortened DB upgrade validation
vtryo
2
110
なにもしてないのにNew Relicのデータ転送量が増えていたときに確認したこと
tk3fftk
2
230
実務における脅威モデリングを考えよう
nikinusu
1
710
アプリをリリースできる状態に保ったまま 段階的にリファクタリングするための 戦略と戦術 / Strategies and tactics for incremental refactoring
yanzm
6
1.5k
Featured
See All Featured
Robots, Beer and Maslow
schacon
PRO
157
8.2k
Teambox: Starting and Learning
jrom
131
8.7k
Become a Pro
speakerdeck
PRO
22
4.9k
Typedesign – Prime Four
hannesfritz
39
2.3k
What the flash - Photography Introduction
edds
67
11k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
36
2.1k
Documentation Writing (for coders)
carmenintech
65
4.3k
What’s in a name? Adding method to the madness
productmarketing
PRO
21
3k
Done Done
chrislema
180
16k
Building Adaptive Systems
keathley
36
2.1k
Rails Girls Zürich Keynote
gr2m
93
13k
The Pragmatic Product Professional
lauravandoore
31
6.2k
Transcript
Cloud Functions Masaki Iino
Cloud Functions Cloud Functions β版 βリリース時にFirebaseもサポートされた ぼちぼち、GAになるらしい
Cloud Functions • サーバレス • イベント駆動 • ステートレス • Node.js
料金体系
関数の種類 • HTTP Functions ◦ HTTPSリクエストがトリガー ◦ 同期実行 • Background
Functions ◦ Cloud Pub/Sub ◦ Cloud Storage ◦ 非同期実行
HTTP Functions Hello World するならこう 内部的にExpressを使用している exports.helloWorld = function helloWorld
(req, res) { res.send('Hello World!'); };
HTTP Functions デプロイ方法 アップロードするバケットとトリガーを指定 バケットは先に作っておく必要あり $ gcloud beta functions deploy
helloWorld \ --stage-bucket functions-helloWorld \ --trigger-http
Background Functions Hello World するならこう 最後にcallbackを呼ぶ exports.helloWorld = function helloWorld
(event, callback) { callback(); };
Background Functions デプロイ方法 アップロードするバケットとトリガーを指定 $ gcloud beta functions deploy helloWorld
\ --stage-bucket functions-helloWorld \ --trigger-bucket my-bucket $ gcloud beta functions deploy helloWorld \ --stage-bucket functions-helloWorld \ --trigger-topic my-topic
パッケージ package.jsonを記述すれば、クラウド上でnpm installされる。 "dependencies": { "request": "^2.81.0" }, const request
= require('request'); exports.helloWorld = function helloWorld (req, res) { request('http://www.google.com', (error, response, body) => { res.send('Hello World!'); } };
ログ Stackdriver Loggingに出力される(console.logを使う)
モニタリング 呼び出し回数 / 実行時間 / メモリ使用量
開発環境 公式のエミュレータがあります。(まだalpha
デモ