PMLE Practice Question: Training a scikit-learn random forest model on a large tabular dataset using a Vertex AI…
You are training a scikit-learn random forest model on a large tabular dataset using a Vertex AI custom training job. The training script reads a CSV file from a Cloud Storage bucket and writes the trained model artifact to the same bucket. You need to ensure the training job can access the Cloud Storage bucket without embedding long-lived credentials in the container. What should you do?
⚠ Common exam trap
The trap here is assuming that a service account key file or default credentials are required, when Vertex AI training jobs natively support attaching a custom service account for automatic authentication.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Attach a custom service account to the Vertex AI training job that has the Storage Object Viewer and Storage Object Creator roles on the bucket, and let the Vertex AI Training service use the service account's credentials automatically.
The correct approach is to attach a custom service account with least-privilege Cloud Storage roles to the Vertex AI training job. Vertex AI training jobs automatically use the credentials of the attached service account via the metadata server, so no key files are needed. This ensures secure, short-lived authentication and follows Google Cloud best practices for access control.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Grant the Vertex AI Service Agent role to the default Compute Engine service account and rely on the default credentials provided by the training environment to access the bucket.
Why it's wrong here
The default Compute Engine service account may have broad permissions, but granting the Vertex AI Service Agent role does not grant Cloud Storage access. The training job would still lack the necessary Storage Object Viewer and Creator permissions unless those roles are explicitly granted to the service account used by the job.
- ✗
Configure the training job to use a user-managed service account that has the Editor role on the project, ensuring it has sufficient permissions to read and write to any Cloud Storage bucket.
Why it's wrong here
Using a service account with the Editor role violates the principle of least privilege. While it would grant access, it provides excessive permissions beyond what is needed for reading and writing to the specific bucket. A custom service account with only the required Storage roles is the correct, secure approach.
- ✓
Attach a custom service account to the Vertex AI training job that has the Storage Object Viewer and Storage Object Creator roles on the bucket, and let the Vertex AI Training service use the service account's credentials automatically.
Why this is correct
Vertex AI custom training jobs can run as a user-managed service account. Its short-lived credentials reach the container automatically through the metadata server, so client libraries authenticate through Application Default Credentials with no key file. Granting only Storage Object Viewer and Storage Object Creator on this bucket follows least privilege, and the launching user needs the Service Account User role on that account.
- ✗
Create a service account key file, store it in Secret Manager, and mount it into the training container as a volume so the scikit-learn script can read the key and authenticate to Cloud Storage.
Why it's wrong here
While Secret Manager can store secrets, mounting a service account key file requires managing key rotation and exposes long-lived credentials to the container. Vertex AI training jobs already have access to a metadata server that provides short-lived tokens for the attached service account, making key files unnecessary and less secure.
Go deeper
Related to this question
About these practice questions
One of 775 original PMLE practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
You might also like
Similar PMLE questions
- A machine learning engineer is deploying a TensorFlow model on an edge device with limited memory and compute. The model…
- A company has a TensorFlow model for image classification that must run on edge devices with limited memory. They need t…
- You want to use Vertex AI JumpStart to quickly deploy a pre-built foundation model for text summarization. Which action…
- An ML engineer is preparing to train a large model on Vertex AI using a custom training job. The training data is stored…
- You are running a distributed training job on Vertex AI using PyTorch and the DistributedDataParallel (DDP) strategy acr…
Written and reviewed by Johnson Ajibi, MSc IT Security
Security Systems Architect · founder of Courseiva
Last reviewed September 2026 · checked against the official Google Cloud exam blueprint
This PMLE practice question is part of Courseiva's free Google Cloud certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PMLE exam.