PROFESSIONAL-CLOUD-DEVOPS-ENGINEER practice question 6 of 25
[Building and implementing CI/CD pipelines for a service] You are building an application that runs on Cloud Run The application needs to access a third-party API by using an API key You need to determine a secure way to store and use the API key in your application by following Google-recommended practices What should you do?
Full set: 205 questionsThe Google-recommended practice for managing secrets like API keys for Cloud Run is to use Secret Manager. You store the API key as a secret in Secret Manager and then configure your Cloud Run service to access this secret. Cloud Run has native integration with Secret Manager, allowing you to securely mount the secret's value as an environment variable. This approach avoids hardcoding secrets in your container image or source code and leverages a purpose-built, fully managed service for secret storage, access control, and auditing.
B. While mounting a secret as a file is possible, this option unnecessarily adds a decryption step. Secrets in Secret Manager are already encrypted at rest and transmitted securely.
C. Cloud Key Management Service (Cloud KMS) is for managing cryptographic keys and performing encryption/decryption operations, not for storing arbitrary secret data like API keys. Secret Manager is the correct tool.
D. This describes envelope encryption, which is a valid but overly complex pattern for this use case. Using the direct Secret Manager integration is simpler, more idiomatic, and the recommended best practice.
1. Google Cloud Documentation, "Cloud Run: Using secrets". This official guide explicitly states the recommended practice: "The recommended way to use secrets in Cloud Run is to store them in Secret Manager and then configure your Cloud Run service to access them." It provides step-by-step instructions for mounting secrets as environment variables.
2. Google Cloud Documentation, "Secret Manager: Overview". The documentation describes Secret Manager as the service to "Store API keys, passwords, certificates, and other sensitive data." It highlights integrations with other Google Cloud products, including Cloud Run.
3. Google Cloud Security Best Practices Center, "Managing secrets". This guide recommends centralizing secret management using a service like Secret Manager and avoiding storing secrets in environment variables directly in the configuration files, source code, or container images. The Cloud Run integration handles this securely.
Keep practicing
Take the free PROFESSIONAL-CLOUD-DEVOPS-ENGINEER practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other PROFESSIONAL-CLOUD-DEVOPS-ENGINEER practice questions
- Question 1[Building and implementing CI/CD pipelines for a service] You need to enforce several con…
- Question 2You deployed an application into a large Standard Google Kubernetes Engine (GKE) cluster.…
- Question 3You are responding to a high-priority incident where a critical, user-facing payment serv…
- Question 4[Applying Site Reliability Engineering (SRE) principles to a service] You support a user-…
- Question 5You are deploying an application that needs to access sensitive information. You need to …
- Question 7[Optimizing service performance] You support a Node.js application running on Google Kube…
