easygcloud
Grant a service account the Pub/Sub Publisher role on a specific topic
command
gcloud pubsub topics add-iam-policy-binding order-events --member=serviceAccount:app-sa@my-project.iam.gserviceaccount.com --role=roles/pubsub.publishercommand
gcloud pubsub topics add-iam-policy-binding order-events --member=serviceAccount:app-sa@my-project.iam.gserviceaccount.com --role=roles/pubsub.publisherPart of the Google Cloud CLI (gcloud) — Pub/Sub category.
| Flag | Purpose |
|---|---|
--member | Set to: serviceAccount:app-sa@my-project.iam.gserviceaccount.com |
--role | Set to: roles/pubsub.publisher |
Test your recall — not just your reading.
Practice with interactive quiz →