nerdexam
Google

PROFESSIONAL-CLOUD-DEVOPS-ENGINEER · Question #127

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…

The correct answer is A. Save the API key in Secret Manager as a secret. Reference the secret as an environment. To securely manage an API key for a Cloud Run application, store it in Secret Manager and reference it as an environment variable.

Submitted by klara.se· Apr 18, 2026Applying site reliability engineering principles to a service

Question

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?

Options

  • ASave the API key in Secret Manager as a secret. Reference the secret as an environment
  • BSave the API key in Secret Manager as a secret key. Mount the secret key under the /sys/api_key
  • CSave the API key in Cloud Key Management Service (Cloud KMS) as a key. Reference the key
  • DEncrypt the API key by using Cloud Key Management Service (Cloud KMS), and pass the key to

How the community answered

(49 responses)
  • A
    76% (37)
  • B
    4% (2)
  • C
    14% (7)
  • D
    6% (3)

Why each option

To securely manage an API key for a Cloud Run application, store it in Secret Manager and reference it as an environment variable.

ASave the API key in Secret Manager as a secret. Reference the secret as an environmentCorrect

Storing the API key in Google Cloud Secret Manager provides a centralized, secure, and versioned way to manage sensitive data. Referencing the secret as an environment variable in Cloud Run is a standard and secure practice that injects the secret into the application at runtime without hardcoding it or committing it to source control.

BSave the API key in Secret Manager as a secret key. Mount the secret key under the /sys/api_key

While Secret Manager is correct, mounting the secret under `/sys/api_key` (or any file path) is typically used for specific scenarios like Kubernetes secrets mounted as volumes, but environment variables are the more common and often simpler recommended approach for secrets in Cloud Run, and `/sys` is a system directory not for application secrets.

CSave the API key in Cloud Key Management Service (Cloud KMS) as a key. Reference the key

Cloud Key Management Service (Cloud KMS) is primarily for managing cryptographic keys for encryption, not for storing arbitrary secrets like API keys directly for application consumption as environment variables.

DEncrypt the API key by using Cloud Key Management Service (Cloud KMS), and pass the key to

Encrypting the API key with Cloud KMS and passing the encrypted key requires the application to decrypt it, which adds complexity and means the decryption key itself needs to be managed securely, whereas Secret Manager handles direct injection more efficiently.

Concept tested: Secure Secret Management (Secret Manager, Cloud Run)

Source: https://cloud.google.com/secret-manager/docs/access-secrets-cloud-run

Topics

#Cloud Run#Secret Manager#API Key Management#Application Security

Community Discussion

No community discussion yet for this question.

Full PROFESSIONAL-CLOUD-DEVOPS-ENGINEER Practice