Google Monitoring - Back up user created alert policies

I have created 30 alerting policies.

What is the easiest way I can backup all the policies I have created?

1 Like

Hello @tacoma50 ,Welcome on Google Cloud Community.

You can utilize gcloud beta resource-config bulk-export to export your existing infra to terraform / documentation here: https://cloud.google.com/docs/terraform/resource-management/export

You can download alerting policy in JSON / YAML via following this steps: https://cloud.google.com/monitoring/alerts/policies-in-json#generate_yaml_for_existing_policies

You can use API: https://cloud.google.com/monitoring/alerts/using-alerting-api#api-backup-policies

From my perspective the easiest way would be go to Project → Monitoring → Alerting Policies. Then, find the policy that you want to view, and then click the policy name to open the Policy details page. Next Click :down_arrow: J****SON. By those steps you will download alerting-policy.json file, which could be importer easily by gcloud command later.


cheers,
DamianS
LinkedIn medium.com Cloudskillsboost Sessionize Youtube

1 Like