tech-memo

Google Cloud CLI(Cloud SDK)

インストール

これに従う https://cloud.google.com/sdk/docs/install-sdk#mac

gcloud init

これでgoogleアカウントを認証する プロジェクトを選択するリストが出てくるので最初にプロジェクトを作っておく

gcloud components update
gcloud components install beta
gcloud config set functions/region asia-east1
pip install --upgrade google-cloud-storage

ローカルでの開発

pip install functions-framework
functions_framework --target=YOUR_FUNCTION_NAME
curl http://localhost:8080 -H "Content-Type:application/json"  -d '{"name":"Jane"}'

デプロイ

gcloud init

でプロジェクトを選択し直して、以下を実行.

gcloud functions deploy ExtractRivalKeywords --entry-point extractRivalKeywords --runtime python38 --trigger-http --region asia-northeast1

トリガーの種類は↓に https://cloud.google.com/functions/docs/concepts/events-triggers