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
1 Answer
Reset to default 0From the docs:
public static ProfileCredentialsProvider create(String profileName)
Create a
ProfileCredentialsProvider
using the given profile name andProfileFile.defaultProfileFile()
. Usebuilder()
for defining a customProfileCredentialsProvider
.Parameters:
profileName
- the name of the profile to use from theProfileFile.defaultProfileFile()
See: ProfileCredentialsProvider.html#create(java.lang.String)