Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Acces Google Pub/Sub from outside of GCP

Is it possible to directly send data to Cloud Pub/Sub from the internet? As far as i understand, this would be only possible using a service account. Is that right?


2 Answers

You can access Cloud Pub/Sub (and other Google Cloud Platform services) from outside the Google Cloud, yes. You need to be authenticated, which means either using a service account or authenticating as an end user who has access to the project. You can read more details in the Authentication Overview for Google Cloud Platform. The information is not specific th Cloud Pub/Sub.

like image 63
Kamal Aboul-Hosn Avatar answered Dec 01 '25 16:12

Kamal Aboul-Hosn


Yes, it's possible. The schema here looks like that:

  1. Create a new service account, that will be used for further authentication.
  2. Attach "Pub/Sub Editor" role to it (or set more granular permissions through IAM) - for authorization.
  3. Create an export JSON-key of the newly created service account.
  4. In your app outside GCP use the key to be authenticated with enough permissions. For example, in Go applications we could use it with ClientOption of Google API client: option.WithCredentialsJSON([]byte(JSON_KEY_CONTENT))

No matter what language/library you use, the main idea is to sign every your request to GCP, using the created service account.

like image 36
Wishmaster Avatar answered Dec 01 '25 14:12

Wishmaster



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!