Created
March 15, 2021 04:27
-
-
Save takada-at/5f2d516c8293edf6d9d16114d97dc63d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CMDNAME=`basename $0` | |
if [ $# -ne 2 ]; then | |
echo "Usage: $CMDNAME account email" 1>&2 | |
exit 1 | |
fi | |
ACCOUNT=$1 | |
EMAIL=$2 | |
ZONE=us-west1-b | |
SERVICE_ACCOUNT=${ACCOUNT}[email protected] | |
gcloud --project pj-kec4 iam service-accounts add-iam-policy-binding ${SERVICE_ACCOUNT} --member="user:${EMAIL}" --role='roles/iam.serviceAccountUser' | |
gcloud --project pj-kec4 compute instances add-iam-policy-binding ${ACCOUNT}-instance \ | |
--zone ${ZONE} \ | |
--member "user:${EMAIL}" --role 'roles/compute.instanceAdmin.v1' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment