Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning message from AWS Java SDK on startup about redundant profile prefix #592

Closed
2 of 3 tasks
tomelliff opened this issue May 20, 2020 · 2 comments
Closed
2 of 3 tasks

Comments

@tomelliff
Copy link

tomelliff commented May 20, 2020

  • I am using the latest release of AWS Vault
$ aws-vault --version
v6.0.0-beta5
  • I have provided my .aws/config (redacted if necessary)
[default]
region = eu-west-1

[profile organisation]

[profile account1-read-only]
role_arn = arn:aws:iam::1234567890:role/read-only
source_profile = organisation

[profile account1-admin-read-only]
role_arn = arn:aws:iam::1234567890:role/admin-read-only
source_profile = organisation
mfa_serial = arn:aws:iam::1234567890:mfa/user

...
  • I have provided the debug output using aws-vault --debug (redacted if necessary)

When running a Java application locally I get the following warning from the AWS SDK:

WARNING: Your profile name includes a 'profile ' prefix. This is considered part of the profile name in the Java SDK, so you will need to include this prefix in your profile name when you reference this profile from your Java code.
May 20, 2020 5:43:41 PM com.amazonaws.auth.profile.internal.BasicProfileConfigLoader loadProfiles

for every profile in my ~/.aws/config file.

This happens regardless of whether AWS-Vault is actually used via aws-vault exec profile-name -- java -jar ... or if it's just ran directly (so without credentials from AWS-Vault).

This suggests that AWS-Vault shouldn't be expecting the profile prefix here if it wants to be fully compatible with the AWS SDKs. This warning is also mentioned in this Stack Overflow post but for an older warning 3 years ago so it sounds like it's been a problem for a while although I hadn't personally noticed it previously and was just flagged by a colleague.

We generate the config for AWS-Vault with all of the profiles for all of our accounts (even if the user doesn't have the necessary IAM permissions to assume them at that time) so we have a lot of these profiles and it creates a lot of noise on startup when people are developing locally.

Removing the profile prefix from the source profile block (that is empty) seems fine for AWS-Vault but if I remove the profile prefix from the target profile I get the following error:

$ aws-vault exec account1-read-only -- /usr/local/bin/aws sts get-caller-identity
aws-vault: error: exec: Error getting temporary credentials: profile account1-read-only: credentials missing

Adding the profile prefix back fixes things so that it correctly assumes the role indicated in the profile.

@mtibben
Copy link
Member

mtibben commented May 21, 2020

This doesn't appear to be the behaviour of the AWS CLI - it adds the profile prefix, and doesn't recognise sections without it

$ aws configure --profile testprofile
AWS Access Key ID [None]:
AWS Secret Access Key [None]:
Default region name [None]: us-west-2
Default output format [None]:
$ cat ~/.aws/config | grep testprofile
[profile testprofile]

Manually adding

[testprofile2]
region = us-west-2
$ aws s3 ls --profile testprofile2

The config profile (testprofile2) could not be found

@tomelliff
Copy link
Author

Yeah this looks like it might be just the Java SDK doing something stupid as mentioned in this issue. I think this can probably be closed as an issue on the Java SDK's side as the other SDKs don't do this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants