问题描述
我们可以使用以下命令在 AI Platform Unified (GCP) 上创建服务帐户:
gcloud beta services identity create --service=aiplatform.googleapis.com
但这只会创建一个服务帐户,但我们需要两个:
"AI Platform Service Agent": servicexxx@gcp-sa-aiplatform.iam.gserviceaccount.com
我们还需要创建第二个服务帐户:
"AI Platform Custom Code Service Agent":service-xxx@gcp-sa-aiplatform-cc.iam.gserviceaccount.com
如何自动创建第二个服务帐号“service-xxx@gcp-sa-aiplatform-cc.iam.gserviceaccount.com”?
解决方法
在等待 GCP 提供一个干净的解决方案的同时,运行这个虚拟作业(新项目中不需要用户提供任何东西),将自动创建我们需要的 SA:
gcloud beta ai custom-jobs create --display-name test1 --region europe-west4 --worker-pool-spec=replica-count=1,machine-type=n1-highmem-2,container-image-uri=gcr.io/google-appengine/python
几乎在提交作业后,将立即创建以下内容:
"AI Platform Custom Code Service Agent":service-xxx@gcp-sa-aiplatform-cc.iam.gserviceaccount.com