Skip to content

trying to get AWS SDK facerekog working on my local

0

I am getting the following stacktrace from my Java client Exception in thread "main" software.amazon.awssdk.core.exception.SdkClientException: Profile file contained no credentials for profile 'profile-name': ProfileFile(sections=[profiles, sso-session, services], profiles=[Profile(name=PowerUserAccess-441168212764, properties=[sso_session, output, sso_role_name, region, sso_account_id]), Profile(name=441168212764, properties=[aws_access_key_id, aws_secret_access_key]), Profile(name=sphof, properties=[aws_access_key_id, aws_secret_access_key])]) at software.amazon.awssdk.core.exception.SdkClientException$BuilderImpl.build(SdkClientException.java:130)

I can login with asw sso login using the following credential and config files using MFA

credentials file [PowerUserAccess-441168212764] aws_access_key_id = <key id removed> aws_secret_access_key = <access key removed>

config file [profile PowerUserAccess-441168212764] sso_session = my-sso sso_account_id = 441168212764 sso_role_name = PowerUserAccess region = us-west-2 output = json

[sso-session my-sso] sso_region = us-west-2 sso_registration_scopes = sso:account:access sso_start_url = https://empirestateids.awsapps.com/start

When I run the Java client it throws and exception when running the client I have granted user PowerUserAccess-441168212764 to have privs for the AWS Rekog perm. Not sure what I am doing wrong or which direction to go in next. thx Charlie

asked 12 days ago16 views
1 Answer
0

Based on the error message, it appears that your Java client is trying to use a profile named 'profile-name' which doesn't exist in your credentials file. The error shows that your credentials file contains three profiles: 'PowerUserAccess-441168212764', '441168212764', and 'sphof'.

There are two ways to fix this issue:

  1. Update your Java code to use one of the existing profiles. For example, if you want to use the 'PowerUserAccess-441168212764' profile, you would modify your code to use that profile name when creating the credentials provider:
AWSCredentials credentials = new ProfileCredentialsProvider("PowerUserAccess-441168212764").getCredentials();
  1. Alternatively, you could add a 'default' profile to your credentials file if your code is using the default profile. In your credentials file, add:
[default]
aws_access_key_id = YOUR_AWS_ACCESS_KEY_ID
aws_secret_access_key = YOUR_AWS_SECRET_ACCESS_KEY

Replace the placeholder values with your actual AWS access key ID and secret access key.

Make sure that the profile you're using has the necessary permissions for Amazon Rekognition. You mentioned that you've granted the PowerUserAccess-441168212764 user the necessary permissions, so using that profile should work if configured correctly in your code.

Also, ensure that your credentials file is saved in the correct location:

  • On Windows: C:\Users<yourUserName>.aws\credentials
  • On Linux, macOS, or Unix: ~/.aws/credentials

Remember not to include a file extension when saving the credentials file.
Sources
Create a shared credentials file - Amazon Simple Email Service
DescribeCertificateAuthority - AWS Private Certificate Authority
ProfileCredentialsUtils (AWS SDK for Java - 2.21.29)
AWS IAM credentials - AWS Toolkit for VS Code

answered 12 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.