Hi! We are having trouble launching a gemini-flash Vertex ai batch prediction job within a Workflows step. We tried granting different roles to the service account associated to it, and different ways to specify the GCP project and location. If anyone has some experience using vertex ai services and Workflows, or you have any suggestions on how to proceed it would be of great help
Error we receive:
google.api_core.exceptions.PermissionDenied: 403 Permission âaiplatform.batchPredictionJobs.createâ denied on resource â//aiplatform.googleapis.com/projects/PROJECT_ID/locations/LOCATION_IDâ (or it may not exist). [reason: âIAM_PERMISSION_DENIEDâ
Granted roles:
Vertex AI Batch Prediction Service Agent
Vertex AI Custom Code Service Agent
Vertex AI Service Agent
Vertex AI User
The error message 403 Permission âaiplatform.batchPredictionJobs.createâ denied indicates that the service account used by your Workflows execution does not have permission to create a batch prediction job in Vertex AI. Even though youâve granted several Vertex AI-related roles, the specific role/permission needed for the aiplatform.batchPredictionJobs.create action is likely missing or not correctly configured.
Here are some possible ways to address your issue:
Identify the Correct Service Account****: Determine which service account is running your Workflow. Itâs likely not the one youâve granted roles to, but rather the Workflow service account itself (it can be a default account or one you set).
Grant the Necessary IAM Role****: Give the correct service account the roles/aiplatform.admin (for full access) or roles/aiplatform.batchPredictionJobUser (for specific access to batch jobs) role on your Vertex AI project.
Verify Project and Location: Ensure that the project and location are being correctly passed to the Vertex AI service when creating the prediction job.
You can also read the following documentation for more details:
Create a batch prediction job: This documentation explains how to create a batch prediction job in Vertex AI using different interfaces, including the API, and highlights the required parameters.
Vertex AI API Reference: You can browse the API reference to find the BatchPredictionJob.create method and all the parameters you need to correctly call the API from your workflow.
Was this helpful? If so, please accept this answer as âSolutionâ. If you need additional assistance, reply here within 2 business days and Iâll be happy to help.
Thank you very much for the response! Indeed, the issue was that we were using cloud run to launch the batch job using python (orchestrated by Workflows). The roles were ok, but we had to give permission to the cloud run service account, not the workflows service account, as it wasnât directly executing the batch job. After that, it worked flawlessly. Marking as solved!