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
570
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
250
AnyPay ChatOps
iinomasaki
0
1.2k
Istio
iinomasaki
0
1.6k
GolangでAPIドキュメント自動生成
iinomasaki
0
730
Other Decks in Technology
See All in Technology
SREとソフトウェア開発者の合同チームはどのようにS3のコストを削減したか?
muziyoshiz
1
100
成長自己責任時代のあるきかた/How to navigate the era of personal responsibility for growth
kwappa
3
270
職種別ミートアップで社内から盛り上げる アウトプット文化の醸成と関係強化/ #DevRelKaigi
nishiuma
2
140
E2Eテスト設計_自動化のリアル___Playwrightでの実践とMCPの試み__AIによるテスト観点作成_.pdf
findy_eventslides
0
260
Why React!?? Next.jsそしてReactを改めてイチから選ぶ
ypresto
10
4.5k
Shirankedo NOCで見えてきたeduroam/OpenRoaming運用ノウハウと課題 - BAKUCHIKU BANBAN #2
marokiki
0
150
10年の共創が示す、これからの開発者と企業の関係 ~ Crossroad
soracom
PRO
1
190
データエンジニアがこの先生きのこるには...?
10xinc
0
450
Azure SynapseからAzure Databricksへ 移行してわかった新時代のコスト問題!?
databricksjapan
0
140
ZOZOのAI活用実践〜社内基盤からサービス応用まで〜
zozotech
PRO
0
170
コンテキストエンジニアリングとは? 考え方と応用方法
findy_eventslides
4
900
「Verify with Wallet API」を アプリに導入するために
hinakko
1
240
Featured
See All Featured
Building Flexible Design Systems
yeseniaperezcruz
329
39k
The Art of Programming - Codeland 2020
erikaheidi
56
14k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
45
2.5k
The Power of CSS Pseudo Elements
geoffreycrofte
79
6k
[RailsConf 2023] Rails as a piece of cake
palkan
57
5.9k
Six Lessons from altMBA
skipperchong
28
4k
Making Projects Easy
brettharned
119
6.4k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Agile that works and the tools we love
rasmusluckow
331
21k
Statistics for Hackers
jakevdp
799
220k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
140
34k
GraphQLとの向き合い方2022年版
quramy
49
14k
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
デモ