最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

amazon web services - AWS Java SDK 2.x ProfileCredentialsProvider support multiple profile names - Stack Overflow

programmeradmin2浏览0评论

I am creating an application which needs to access AWS resources by all of my team members. I have used ProfileCredentialsProvider for authentication to AWS. It picks the 'default' profile by default. But some of my team members have a different/custom profile names. Is it possible to configure ProfileCredentialsProvider to pick any available profile name in the .aws/credentials file without restrictions?

I am creating an application which needs to access AWS resources by all of my team members. I have used ProfileCredentialsProvider for authentication to AWS. It picks the 'default' profile by default. But some of my team members have a different/custom profile names. Is it possible to configure ProfileCredentialsProvider to pick any available profile name in the .aws/credentials file without restrictions?

Share Improve this question edited Mar 19 at 19:11 Alexander 1,3411 gold badge16 silver badges29 bronze badges asked Mar 18 at 16:41 Vel GaneshVel Ganesh 5533 gold badges12 silver badges34 bronze badges 4
  • Can you share some code? ProfileCredentialsProvider, when using the builder, allows you to pass a profile name. It's not clear what issue you're having. – stdunbar Commented Mar 18 at 17:42
  • My requirement is to not pass a profile name, but take whatever profile is available in the credentials file. Is it possible? – Vel Ganesh Commented Mar 19 at 19:09
  • What good does it do to pick a random profile? Are your process so bad that all profiles have the same permissions? If so, then create a "default" even if it has the same credentials as another profile. Or have your users set the AWS_PROFILE environment variable. – stdunbar Commented Mar 21 at 1:35
  • AWS_PROFILE seems to be the best option here. Can you please respond the same in the answers section, so that I can mark it as accepted? – Vel Ganesh Commented Mar 21 at 5:34
Add a comment  | 

1 Answer 1

Reset to default 0

From the docs:

public static ProfileCredentialsProvider create(String profileName)

Create a ProfileCredentialsProvider using the given profile name and ProfileFile.defaultProfileFile(). Use builder() for defining a custom ProfileCredentialsProvider.

Parameters:

profileName - the name of the profile to use from the ProfileFile.defaultProfileFile()

See: ProfileCredentialsProvider.html#create(java.lang.String)

发布评论

评论列表(0)

  1. 暂无评论