How to find other AWS Users Canonical Id using Root User credentials

1.6k views Asked by At

I am having AWS Root User credentials. I have created 5 users through https://console.aws.amazon.com/iam/home?region=us-east-1#/users -> Add User. Out of 5 (2 Programmatic User and 3 AWS Management Console access users).

How can I find all 5 user's Canonical Id or Mail Id, through Java API or https End Point using Root User's Credentials?

1

There are 1 answers

1
Marcin On

Sadly you can't do this. This is because Canonical user ID is the ID for the entire account, not individual IAM users:

An alpha-numeric identifier, such as 79a59df900b949e55d96a1e698fbacedfd6e09d98eacf8f8d5218e7cd47ef2be, that is an obfuscated form of the AWS account ID. You can use this ID to identify an AWS account when granting cross-account access to buckets and objects using Amazon S3. You can retrieve the canonical user ID for your AWS account as either the root user or an IAM user.

To get it for the account, you can use CLI or any equivalent in SDK:

aws s3api list-buckets --query Owner.ID --output text