robo-tt
robo-tt

Reputation: 72

How to trigger a Google Cloud Function when a scheduled compute engine "disk snapshot" is created

When a "disk snapshot" is created in Google Cloud - I scheduled the "disk snapshots" with the Google Cloud dashboard - I need to turn it into an "Image", and then export the image to a third party host using SFTP.

I have been unable to trigger a Google Cloud Function (it would launch the gcloud command to create an "Image" from the "disk snapshot") when a scheduled compute engine "disk snapshot" is created.

In the Google Cloud Logs Explorer I don't see any related event, even if I just search by "snapshot".

I have tried creating an EventArc trigger with event type google.cloud.audit.log.v1.written and event method beta.compute.disks.createSnapshot, but obviously it doesn't work, because there is no such event logged.

I have also tried enabling "Admin Read", "Data Read" and "Data Write" inside "Audit logs" > "Compute Engine API".

Is it even possible to do what I asked?

Or is there a better way to achieve the task?

Upvotes: 0

Views: 129

Answers (1)

damird
damird

Reputation: 73

I'm looking to do the exact same thing. I was able to intercept the v1.compute.snapshots.insert when manually creating a snapshot, but no luck with Scheduled Snapshots.

Did you maybe get it working?

Upvotes: 0

Related Questions