Query to alert when EBS data volume is de-attached from and EC2 instance

Reply
L1 Bithead

Query to alert when EBS data volume is de-attached from and EC2 instance

Looking for help with the right RQL to

alert when any EBS data volume is de-attached from an EC2 instance

L1 Bithead

Re: Query to alert when EBS data volume is de-attached from and EC2 instance

This is a built-in policy:

"AWS EBS Volume is unattached"

 

RQL:

config where cloud.type = 'aws' AND api.name = 'aws-ec2-describe-volumes' AND json.rule = attachments[*] all empty or attachments[*].state does not contain "attached"

L1 Bithead

Re: Query to alert when EBS data volume is de-attached from and EC2 instance

Thanks for the query.

However, Question was about the detection event, if there was any volume de-attached. Later on, maybe that was left in the de-attached state or may be attached to another machine or attached to the same machine.

This query provided simply returns the de-attached volume list.

We might have to look at audit events.

Highlighted
L2 Linker

Re: Query to alert when EBS data volume is de-attached from and EC2 instance

This should get you started: 

event where operation = 'DetachVolume'

If you are looking for a specific user doing the action, you can add subject or role using the AND function.

Like what you see?

Show your appreciation!

Click Like if a post is helpful to you or if you just want to show your support.

Click Accept as Solution to acknowledge that the answer to your question has been provided.

The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!

These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the Live Community as a whole!

The Live Community thanks you for your participation!