summaryrefslogtreecommitdiff
path: root/scripts/00-create-service-account.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/00-create-service-account.sh')
-rwxr-xr-xscripts/00-create-service-account.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/scripts/00-create-service-account.sh b/scripts/00-create-service-account.sh
new file mode 100755
index 0000000..984e55b
--- /dev/null
+++ b/scripts/00-create-service-account.sh
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+gcloud iam service-accounts create ${SERVICE_ACCOUNT} \
+ --description="Spark access account to Google Cloud Buckets" \
+ --display-name="Spark to Bucket"
+
+gcloud projects add-iam-policy-binding ${PROJECT} \
+ --member="serviceAccount:${SERVICE_ACCOUNT}@${PROJECT}.iam.gserviceaccount.com" \
+ --role="roles/storage.objectAdmin"
+
+gcloud projects add-iam-policy-binding ${PROJECT} \
+ --member="serviceAccount:${SERVICE_ACCOUNT}@${PROJECT}.iam.gserviceaccount.com" \
+ --role="roles/dataproc.worker"
+
+gcloud iam service-accounts keys create ./google-service-account-key.json \
+ --iam-account=${SERVICE_ACCOUNT}@${PROJECT}.iam.gserviceaccount.com