[英]Access AWS Root User account using java
AWS Root user account details AWS Root用户帐户详细信息
Is there any API by which we can get information of the AWS root user account details? 是否有任何API可以用来获取AWS root用户帐户详细信息的信息?
ListUsersRequest request = new ListUsersRequest();
ListUsersResult response = iam.listUsers(request);
response.getUsers()
The code list all users not the root user account details 该代码列出了所有用户而不是root用户帐户的详细信息
The root user is not an IAM user, so it won't appear in the list of IAM users. 根用户不是IAM用户,因此它不会出现在IAM用户列表中。
If you don't mind me asking, what are you trying to access the root user for? 如果您不介意我问,您要尝试访问root用户的目的是什么?
You can create a set of access keys for the root user and have java connect via those access keys. 您可以为root用户创建一组访问密钥,并通过这些访问密钥来连接java。
Info on how to generate root user access keys can be found here, in the AWS documentation . 有关如何生成root用户访问密钥的信息,请参见AWS文档 。
Java can be configured to use access credentials as noted here . Java可以被配置为使用访问凭据注意到这里 。
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.
根据您要执行的操作,理想情况下,您应该以使用IAM用户和角色而不是根凭据为目标。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.