Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (5.6k points)

My question is that, Is there any way to know the AWS account ID for IAM users? So that I can store them in the database and if any new user comes from that particular account I can block them.

1 Answer

0 votes
by (12.4k points)

Yes, if you have access to IAM get user then that will return ARN for the user which has Account ID. Simply call: 'aws iam get-user' would return,

{

  "User": {

    "UserName": "test",

    "PasswordLastUsed": "2015-01-18T11:08:07Z",

    "CreateDate": "2014-10-21T20:30:04Z",

    "UserId": "AIDAXXXXXXXXXXXXX",

    "Path": "/",

    "Arn":  "arn:aws:iam::123456789012:user/test"

  }

}

Hope this helps!

Want to become AWS Expert? Come & join AWS Certification.

Related questions

0 votes
1 answer
Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...