I am trying to collect event data for any aws resource using CloudTrailClient. This code below works for ec2 instances but doesn't for ebs volumes. Is this the right way to collect the data I am interested in or am I doing something wrong?
fun getResData():Any{
val cloudTrail = CloudTrailClient
.builder()
.credentialsProvider(<credentialsProvider>)
.build()
val request = LookupEventsRequest.builder()
.startTime(OffsetDateTime.now().minusDays(90).toInstant())
.lookupAttributes(
LookupAttribute.builder().attributeKey("ResourceName")
.attributeValue(<vol-id>).build(),
)
.build()
val result = cloudTrail.lookupEvents(request)
return result.events()
}