I am new the Google cloud and evaluating Dataproc cluster and one of the core requirement is to dynamically create a cluster and process the jobs. For the various documentation reads and link, I attempted by creating a service account and added roles starting with "Dataproc Editor".
I generated the key file and activate the service account
gcloud auth activate-service-account --key-file=<Key File>
and try to create a cluster
gcloud beta dataproc clusters create jill-cluster \
--enable-component-gateway \
--subnet default \
--zone europe-west3-b \
--region europe-west3 \
--master-machine-type n1-standard-4 \
--master-boot-disk-size 50 \
--num-workers 2 \
--worker-machine-type n1-standard-4 \
--worker-boot-disk-type pd-ssd \
--worker-boot-disk-size 100 \
--image https://compute.googleapis.com/compute/v1/projects/poc/global/images/poc-1-5-1-debina10 \
--scopes 'https://www.googleapis.com/auth/cloud-platform' \
--project poc \
--verbosity info \
--autoscaling-policy=poc-auto-scale-policy \
--service-account=<Service account>
I am getting this error
{
"code": 403,
"message": "Not authorized to requested resource.",
"status": "PERMISSION_DENIED"
}
and I started added more roles to the service account and ended up as shown below
and still unable to create a cluster. I am not quite sure what i am missing. I tried command line as well as programmatic approach which resulted the same. Unfortunately i could not able to get enough clue from the logging as well.
---------- Update ---------------
I think I missed out some info in my initial question. I have an user account with owner role and was currently using that account to experiment and using that i can able to create cluster and submit jobs. So i think the project has the necessary required roles.
Now I want to move towards automation and want to achieve
- Manage the cluster using a service account
- Should able to submit and run the jobs and manage the jobs.
I started both responsibilities with a single account but as suggested i can start having different service accounts.
gcloud dataproc clusters listafter runningactivate-service-account? Did you add the roles at the project level? Or is it possible you added the roles on the service-account account itself as a target resource? You should expect to see the service account listed as a "member" ingcloud projects get-iam-policy <your-project>and not ongcloud iam service-accounts get-iam-policy <service-account>- Dennis Huogcloud dataproc clusters listand still getting the same error. I think this should be cleared before i try your big answer. - Srinivas Jillgcloud compute regions listangcloud compute instances list? - Dennis Huo//cloudresourcemanager.googleapis.com/projects/YOUR_PROJECTand permissiondataproc.clusters.list- Dennis Huo