RaptorX
RaptorX

Reputation: 139

Create a GCP alert using Service Account

I am trying to create a monitoring alert, using a service account in Google Cloud. But there does not seem to be any allowance for using a SA in alert creation. This shows in bigquery scheduled query as a drop down to select SA, but the same feature is not available for alerting. Do suggest if any possibility of implementing the same.

Upvotes: 0

Views: 355

Answers (1)

Mahtab
Mahtab

Reputation: 61

Currently, there is a way to create Alert Policies via API calls. It is currently in Beta.

However, I was able to create an Alert Policy passing the variables as below. In that case, both the caller and service account should have a “Service Account Token Creator” IAM role to perform this operation.

$ gcloud alpha monitoring policies create --impersonate-service-account="[ServiceAccount]" --policy-from-file="[example.json]"

You might find this documentation helpful and recommend you to go through it to help serve your purpose.

Upvotes: 1

Related Questions