简体   繁体   中英

Access AWS Root User account using java

AWS Root user account details

Is there any API by which we can get information of the AWS root user account details?

   ListUsersRequest request = new ListUsersRequest();
   ListUsersResult response = iam.listUsers(request);
   response.getUsers()

The code list all users not the root user account details

The root user is not an IAM user, so it won't appear in the list of IAM users.

If you don't mind me asking, what are you trying to access the root user for?

You can create a set of access keys for the root user and have java connect via those access keys.

Info on how to generate root user access keys can be found here, in the AWS documentation .

Java can be configured to use access credentials as noted here .

I must warn you though, it is EXTREMELY bad practice to ever use your root credentials for things like this. Depending on what you're trying to do, you should ideally aim to use IAM users and roles instead of the root credentials.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM