Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dmitri-lerko/f391bf3b7517eead74539ce24fa6f59b to your computer and use it in GitHub Desktop.
Save dmitri-lerko/f391bf3b7517eead74539ce24fa6f59b to your computer and use it in GitHub Desktop.
Labels all GCS buckets on a project with label bucket:bucket_name for Cost allocation purposes
for bucket in $(gsutil ls -p project_name); do gsutil label ch -l "bucket:$(echo $bucket | cut -c 6- | sed 's/.$//' | sed 's/\./_/g')" $bucket; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment