Skip to content

Instantly share code, notes, and snippets.

@koralle
Created October 24, 2020 10:11
Show Gist options
  • Save koralle/cda77eb13a9d88770b038216e30d436d to your computer and use it in GitHub Desktop.
Save koralle/cda77eb13a9d88770b038216e30d436d to your computer and use it in GitHub Desktop.
Cloud Functionsまとめ

Google Cloud Functionsってなんだ: From Cloud Functions の概要

  • GoolgeのFaaS
  • サーバーレスなので運用管理の必要はなし

Google Cloud Functionsで使用できるランタイム

  • Node.js v10 or v12
  • Python v3.7 or v3.8
  • Go v1.11 or 1.13
  • Java v11

Google Cloud Functionsで何ができる?

例えば、

  • Cloud Storageへファイルをアップロード
  • ログを変更
  • Pub/Subトピックに対するメッセージを受けてそれに応答

Google Cloud Functionsのトリガー

  • DB変更
  • ストレージへのデータ追加
  • 新規作成された仮想マシンのインスタンス
  • HTTPリクエスト

エラーの出し方

  • HTTPリクエストがトリガーなら適切なHTTPステータスコードを返す
  • それ以外がトリガーならエラーメッセージをログに吐く

タイムアウト

  • 関数の実行は制限時間内に終了しなければタイムアウトされる
  • この制限時間のデフォルト値は1分だが、最大9分まで延長可能

その他

  • Google Cloud Functionsの関数内から別のHTTPエンドポイントを叩くことも可能
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment