GCP - Cloud FunctionsYou 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 fileBStore the password in Secret Manager and mount it as an environment variable in Cloud RunCSave the password in a public Google Cloud Storage bucket and read it at runtimeDSend the password as a query parameter in API requestsCheck Answer
Step-by-Step SolutionSolution:Step 1: Identify secure secret storageGoogle Secret Manager is designed to store sensitive info like passwords securely.Step 2: Use environment variables for app accessMounting secrets as environment variables in Cloud Run keeps secrets out of code and config files.Step 3: Evaluate other optionsHardcoding, public storage, or sending passwords in URLs expose secrets and are insecure.Final Answer:Store the password in Secret Manager and mount it as an environment variable in Cloud Run -> Option BQuick 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 filesUsing public storage for sensitive dataExposing secrets in URLs or logs
Master "Cloud Functions" in GCP9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More GCP Quizzes Cloud Firestore and Bigtable - Why NoSQL on GCP matters - Quiz 5medium Cloud Firestore and Bigtable - Firestore document model - Quiz 9hard Cloud Functions - Cold start behavior - Quiz 14medium Cloud IAM Advanced - Policy troubleshooter - Quiz 10hard Cloud IAM Advanced - Data access logs - Quiz 2easy Cloud Load Balancing - URL maps for routing - Quiz 7medium Cloud Monitoring and Logging - Cloud Monitoring overview - Quiz 8hard Cloud Pub/Sub - Message retention and acknowledgment - Quiz 11easy Cloud Run - Cloud Run vs Cloud Functions decision - Quiz 11easy Cloud SQL and Databases - High availability configuration - Quiz 11easy