How do i handle secrets in Google Cloud Functions?

前端 未结 3 2037
没有蜡笔的小新
没有蜡笔的小新 2021-02-13 23:44

What is the common practice here? There seems to be no tools provided by gcloud. I\'m deploying functions from local machine for now, so I can hardcode secrets, but

3条回答
  •  名媛妹妹
    2021-02-14 00:01

    You should use Cloud Key Management Service(KMS).
    Don't push pure secrets to Cloud Functions with files or environment variables.

    One solution is followings:

    1. Create key on Cloud KMS
    2. Encrypt secret file with that key
    3. Upload encrypted secret file to Google Cloud Storage(GCS) (Accessible by specified user)
    4. In Cloud Function Execution, get uploaded secret file from GCS, decrypt, and use it

    [Ref] Secret management using the Google Cloud Platform

提交回复
热议问题