Relevant links and experiments with AWS Athena and CloudTrail

If you’re trying to investigate what operation gave birth to a given Amazon Web Services (AWS) resource, specially one that you will pay for, but are not sure if it is worth paying for, the best way to investigate about it is using AWS CloudTrail.

However, the query abilities of CloudTrail are not that big, and most of the time you will want to dig into them, in particular if you want to make use of things like resource names, or Amazon Resource Names (ARNs).

While I complete the post, here is a list of links, and relevant code that I find useful:

And this is a query that is successful in retrieving resource names for those items that include resource names:

    SELECT uarn,
             eventname,
             sourceipaddress,
             eventtime,
             resources[1].arn as res_arn
    FROM 
        (SELECT useridentity.arn AS uarn,
             eventname,
             sourceipaddress,
             eventtime,
             resources
        FROM cloudtrail_logs_aws_cloudtrail_do_pocops
        WHERE readonly = 'false'
                AND cardinality(resources) >= 1 ) AS t 
    WHERE resources[1].arn like '%resource_id%'
    LIMIT 100;

I’ll keep ellaborating this draft.