Skip to content

Instantly share code, notes, and snippets.

@DashLt
Last active October 27, 2022 05:57
Show Gist options
  • Save DashLt/4c6ff6e9bde4e9bc4a9ed7066c4efba4 to your computer and use it in GitHub Desktop.
Save DashLt/4c6ff6e9bde4e9bc4a9ed7066c4efba4 to your computer and use it in GitHub Desktop.
Quickly make 100 service accounts and generate keys for them
#!/bin/bash
# requires gcloud command line tools; go to https://cloud.google.com/sdk/docs/quickstarts to get them
# max 100 service accounts per project
# run gcloud init --console-only first and select a project
KEYS_DIR=keys
for name in service{1..100}; do echo $name; done | parallel --citation -j100 gcloud iam service-accounts create {}
for name in $(gcloud iam service-accounts list --format='value(email)'); do echo $name; done | parallel --citation -j100 gcloud iam service-accounts keys create $KEYS_DIR/{}.json --iam-account={}
gcloud iam service-accounts list --format='value(email)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment