-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_gcp_api.sh
40 lines (31 loc) · 1.58 KB
/
setup_gcp_api.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#! /bin/bash
export PROJECT_ID=XXX # TODO: Replace with your PROJECT ID
export USER_NAME="[email protected]" # TODO: Replace with your GCP user name
gcloud services enable compute.googleapis.com \
containerregistry.googleapis.com \
aiplatform.googleapis.com \
cloudbuild.googleapis.com \
cloudfunctions.googleapis.com \
--project=${PROJECT_ID}
gcloud storage buckets create gs://training_data_${PROJECT_ID} \
--project=${PROJECT_ID} \
--location="europe-west1"
gcloud iam service-accounts create vertex-ai-service-account \
--description="VertexAI Service Account" \
--display-name="vertex-ai-service-account" \
--project=${PROJECT_ID}
gcloud projects add-iam-policy-binding ${PROJECT_ID} \
--member="serviceAccount:vertex-ai-service-account@${PROJECT_ID}.iam.gserviceaccount.com" \
--role="roles/aiplatform.user"
gcloud projects add-iam-policy-binding ${PROJECT_ID} \
--member="serviceAccount:vertex-ai-service-account@${PROJECT_ID}.iam.gserviceaccount.com" \
--role="roles/storage.objectViewer"
gcloud iam service-accounts add-iam-policy-binding \
vertex-ai-service-account@${PROJECT_ID}.iam.gserviceaccount.com \
--member="user:${USER_NAME}" \
--role="roles/iam.serviceAccountUser"
gsutil iam ch \
serviceAccount:vertex-ai-service-account@${PROJECT_ID}.iam.gserviceaccount.com:roles/storage.objectCreator,objectViewer,objectAdmin \
gs://training_data_${PROJECT_ID}
# download and install GoogleCloudSDK
# gcloud auth application-default login