Bird
0
0

You want to securely provide a database password to a Google Cloud Run service without hardcoding it. Which approach follows best practices?

hard📝 Best Practice Q15 of 15
GCP - Cloud Functions
You want to securely provide a database password to a Google Cloud Run service without hardcoding it. Which approach follows best practices?
AHardcode the password in the Cloud Run service YAML file
BStore the password in Secret Manager and mount it as an environment variable in Cloud Run
CSave the password in a public Google Cloud Storage bucket and read it at runtime
DSend the password as a query parameter in API requests
Step-by-Step Solution
Solution:
  1. Step 1: Identify secure secret storage

    Google Secret Manager is designed to store sensitive info like passwords securely.
  2. Step 2: Use environment variables for app access

    Mounting secrets as environment variables in Cloud Run keeps secrets out of code and config files.
  3. Step 3: Evaluate other options

    Hardcoding, public storage, or sending passwords in URLs expose secrets and are insecure.
  4. Final Answer:

    Store the password in Secret Manager and mount it as an environment variable in Cloud Run -> Option B
  5. Quick Check:

    Secret Manager + env vars = secure best practice [OK]
Quick Trick: Use Secret Manager and env vars, never hardcode secrets [OK]
Common Mistakes:
  • Hardcoding secrets in config files
  • Using public storage for sensitive data
  • Exposing secrets in URLs or logs

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More GCP Quizzes