A security policy requires that an application hosted on a Compute Engine virtual machine in Project-Analytics read log files stored in a Cloud Storage bucket located in Project-Logs. Following Google Cloud security best practices for access control, which setup should you implement?
- Create a user-managed service account in Project-Analytics, grant it the Storage Object Viewer role on the bucket in Project-Logs, and attach this service account to the VM instance.Cevap
- BCreate a service account in Project-Logs, export a JSON key file, and store the key file locally on the VM instance in Project-Analytics to authenticate API requests.
- CGrant the primitive Editor role to the default Compute Engine service account at the Project-Analytics level so permissions automatically inherit to Project-Logs.
- DEnable the Cloud Storage API in Project-Logs and rely on Project-Analytics default network firewall rules to allow access without IAM role assignments.
Cevap
Create a user-managed service account in Project-Analytics, grant it the Storage Object Viewer role on the specific bucket in Project-Logs, and attach that service account to the Compute Engine VM.
Attaching a user-managed service account to a Compute Engine instance and granting that service account the predefined Storage Object Viewer role on the specific bucket in the destination project is the recommended, secure pattern for cross-project resource access inside GCP.
Adım Adım Çözüm
Anahtar Kavram
Cross-Project Service Account Management and Least Privilege