获取Amazon Access Key& amp;Java中IAM用户名的密钥 [英] Get Amazon Access Key & Secret Key from IAM Username in Java

查看:77
本文介绍了获取Amazon Access Key& amp;Java中IAM用户名的密钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了从Java中的Amazon Access Key获取用户名在寻找问题的解决方案时.

I came across Get Username from Amazon Access Key in Java when searching for a solution for a problem I have.

但是唯一的区别是我想实现完全相反的效果:是否可以获取访问密钥& ;?使用IAM中创建的用户名执行Java SDK操作的密钥?

But the only difference is I want to achieve the exact opposite: Is it possible to get the access key & secret key to perform Java SDK operations by using the username created in IAM?

当用户使用其IAM凭据登录时,我想构建一个应用程序,他可以在该应用程序中启动和停止实例.但要做到这一点,我需要访问&该用户的秘密密钥.

I want to build an application when the user logs in with his IAM credentials he can start and stop instances in the application. But to do that I need the access & secret key of that user.

我希望有人能帮助我或知道解决我问题的方法.

I hope someone can help me or knows a workaround for my problem.

谢谢!

推荐答案

假设您的应用程序分别具有自己的足够的AWS安全凭证(例如,通过在具有 ListAccessKeys API操作:

Assuming your application has respectively sufficient AWS security credentials of its own (e.g. by running on an EC2 instance with an IAM Role for Amazon EC2), you can achieve this by means of the ListAccessKeys API action:

返回有关与指定用户关联的访问密钥ID的信息.如果不存在,该操作将返回一个空列表.

Returns information about the access key IDs associated with the specified user. If there are none, the action returns an empty list.

此API操作在适用于Java的AWS开发工具包中显示为 listAccessKeys().

This API action is exposed in the AWS SDK for Java as listAccessKeys().

这篇关于获取Amazon Access Key& amp;Java中IAM用户名的密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆