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
590
1
Share
LT_Cloud_Functions.pdf
社内LT用
Masaki Iino
September 08, 2017
More Decks by Masaki Iino
See All by Masaki Iino
GCP Composer
iinomasaki
0
260
AnyPay ChatOps
iinomasaki
0
1.2k
Istio
iinomasaki
0
1.7k
GolangでAPIドキュメント自動生成
iinomasaki
0
760
Other Decks in Technology
See All in Technology
APIテストとは?
nagix
0
160
Claude code Orchestra
ozakiomumkj
2
650
脅威をエンジニアリングの糧にして:恐怖を乗り越えた先にあったもの / Turn threats into fuel for engineering: what lay beyond overcoming fear
nrslib
1
350
Gradle×GitHub_ActionsでCI時間を約50%短縮 ジョブ分割の設計と落とし穴 / Cutting CI Time by ~50% with Gradle and GitHub Actions: Job-Splitting Design and Pitfalls
takatty
0
530
AI時代から振り返るTerraform drift運用の歴史 / AI Age Reflections on the History of Terraform Drift Operations
aeonpeople
0
590
コードレビューを制するチームがソフトウェアデリバリーのフローを制す / Beyond Code Review: Distributing Its Responsibilities Across the SDLC
mtx2s
1
440
Strands Agents超入門
kintotechdev
1
140
地元にいないローカルオーガナイザーの立ち回り
uvb_76
1
350
Javaで学ぶSOLID原則
negima
1
240
【ハノーバーメッセ振り返りイベントat名古屋】データは集約からAI起点の収集に ~組織内・組織間でのデータ連携~
tanakaseiya
0
150
Fabric-cicd によるAzure DevOps デプロイ
ryomaru0825
0
140
「使われるデータ基盤」を目指してデータアナリストとワークショップをやった話
jackojacko_
2
930
Featured
See All Featured
Facilitating Awesome Meetings
lara
57
6.9k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
370
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
270
Faster Mobile Websites
deanohume
310
31k
Producing Creativity
orderedlist
PRO
348
40k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
420
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
410
Odyssey Design
rkendrick25
PRO
2
640
How STYLIGHT went responsive
nonsquared
100
6.1k
Designing Powerful Visuals for Engaging Learning
tmiket
1
380
30 Presentation Tips
portentint
PRO
1
310
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.1k
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
デモ