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
240
AnyPay ChatOps
iinomasaki
0
1.2k
Istio
iinomasaki
0
1.6k
GolangでAPIドキュメント自動生成
iinomasaki
0
710
Other Decks in Technology
See All in Technology
GitHub Copilot Use Cases at ZOZO
horie1024
0
110
MCP Clientを活用するための設計と実装上の工夫
yudai00
1
810
Introduction to Sansan for Engineers / エンジニア向け会社紹介
sansan33
PRO
5
38k
NW運用の工夫と発明
recuraki
1
800
実践Kafka Streams 〜イベント駆動型アーキテクチャを添えて〜
joker1007
1
590
Houtou.pm #1
papix
0
670
GitHub Coding Agent 概要
kkamegawa
1
1.8k
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
8
65k
RDRA3.0を知ろう
kanzaki
2
440
toittaにOpenTelemetryを導入した話 / Mackerel APM リリースパーティ
cohalz
1
490
AIに実況させる / AI Streamer
motemen
3
1.4k
Flutterアプリを⾃然⾔語で操作する
yukisakai1225
0
130
Featured
See All Featured
Practical Orchestrator
shlominoach
188
11k
Large-scale JavaScript Application Architecture
addyosmani
512
110k
Automating Front-end Workflow
addyosmani
1370
200k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3k
Unsuck your backbone
ammeep
671
58k
Build your cross-platform service in a week with App Engine
jlugia
231
18k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
60k
Mobile First: as difficult as doing things right
swwweet
223
9.6k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
GitHub's CSS Performance
jonrohan
1031
460k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
6
660
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
32
5.8k
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
デモ