A software engineering team is deploying a containerized microservice on a Compute Engine VM instance in the `finance-prod` project. The microservice needs permission to write log entries to Cloud Logging. Google Cloud security policies require following the principle of least privilege and avoiding long-lived credential exports for workloads hosted inside GCP. Which set of actions follows Google Cloud best practices to provision and grant access for this microservice?
- Create a user-managed service account named `app-logger-sa`, grant it the `roles/logging.logWriter` predefined role on project `finance-prod`, and attach the service account to the Compute Engine VM instance.Cevap
- BCreate a user-managed service account named `app-logger-sa`, grant it the `roles/editor` primitive role on project `finance-prod`, and attach the service account to the Compute Engine VM instance.
- CCreate a user-managed service account named `app-logger-sa`, grant it the `roles/logging.logWriter` predefined role, generate a JSON service account key file using `gcloud iam service-accounts keys create`, and copy the key file to the VM instance.
- DCreate a user-managed service account named `app-logger-sa` in a central management project, grant it `roles/logging.logWriter` in `finance-prod`, and enable the Cloud Logging API exclusively in the central management project.
Cevap
Create a user-managed service account named `app-logger-sa`, grant it the `roles/logging.logWriter` predefined role on project `finance-prod`, and attach the service account to the Compute Engine VM instance.
The solution that creates a dedicated service account, assigns the narrow `roles/logging.logWriter` predefined role, and attaches it directly to the VM instance follows both least privilege and GCP identity security standards by using default instance metadata authentication rather than static key files.
Adım Adım Çözüm
Anahtar Kavram
Service Account Creation and Least-Privilege Identity Management
Tahmini Süre:1m 30s