I've written the following query attempting to list all IAM users in my organization.
SELECT
arn,
COUNT(*)
WHERE
resourceType = 'AWS::IAM::User'
GROUP BY
arn
When I run this query in the Advanced query editor against my account, I get one result for the account (As expected)
Output
arn COUNT(*)
arn:aws:iam::99999999:user/foo 1
When I select my Organization Aggregator as the query target (described here), I get multiple results for each ARN - which is impossible.
Output:
arn COUNT(*)
arn:aws:iam::99999999:user/foo 15
arn:aws:iam::99999998:user/foo 15
arn:aws:iam::99999997:user/bar 15
My best guess thus far is that I'm querying "Configuration Items", not resources so I get multiple results. Config has evaluated 15 rules, and the arn field is the resource it evaluated against.
I'm trying to do simple inventory queries, and AWS config doesn't appear to have any sort of unique operator I can use in my SQL syntax... Is there a better query I should be running, or perhaps misconfiguration of my AWS config environment? Why is Config returning the same object so many times?