LoginSignup
5
4

More than 5 years have passed since last update.

Google Cloud Functions の Python コードを Mac のローカル環境で開発〜デプロイする

Last updated at Posted at 2019-01-14

はじめに

Google Cloud Functions は GCP コンソールにもエディタが用意されていますが、ローカルで開発したほうがはかどるので、 Mac で開発してデプロイする方法を備忘録としてまとめておきます。

公式の日本語ドキュメント は記事公開時点では Python のサンプルがないので、 Python ユーザーは 英語ドキュメント 推奨。

gcloud コマンドのインストール

以下のコマンドを実行。 gcloud コマンドをインストールすると Cloud Functions に限らず、 Google Cloud Platform のデプロイなどが可能になる。

$ brew cask install google-cloud-sdk
$ gcloud init
$ gcloud components update && gcloud components install beta

デプロイ

言語が Python で HTTP トリガーを利用する場合は、以下のコマンドを実行するとデプロイできる。

$ gcloud functions deploy graph --runtime python37 --trigger-http

以上。

関連記事

5
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
4