How to do it...

To create the automated alerts when a user creates an instance outside our region of choice (us-west1), we'll need to perform two steps. Firstly, we'll have to create custom metric to identify the breach event. Next, we'll create an alerting policy in Stackdriver Monitoring to send us a notification when the conditions of the custom metric are met:

  1. Navigate to the Stackdriver Logging in the GCP Console.
  2. In the resource dropdown, select GCE VM Instance, which will show us all logs related to VMs:
If you don't have any logs for VM creation in your project, create a test VM to generate the activity logs.
  1. From the drop-down, ...

Get Building Google Cloud Platform Solutions now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.