0
votes

I am new to GCP. My Use case involves reading(PULL) the data from multiple pub-sub subscriptions present in multiple different projects say (A, B, C) to another project say D. I read the documentation for access control in pub-sub. Following that, I tried binding service accounts of project A, B, C (which has publisher/subscriber role) to the topic that is present on project D. After this I tried to pull messages from a subscription present in project A, using "gcloud" command from project D ("gcloud pubsub subscriptions pull [SUBSCRIPTION_NAME_IN_PROJECT_A"), and I am still not able to fetch the result and getting an error as "NOT_FOUND: Resource not found".

Can somebody please help me as how to achieve cross-project communication in pub-sub.

1

1 Answers

0
votes

You need to specify the project with the flag --project. If you do not then it looks for the subscription in the same project you are running the command. More details here

gcloud pubsub subscriptions pull <subs-name project A> --project=<projectId A>