Exception in thread "main" java.lang.IllegalArgumentException: AWS credential profiles file not found in the given path: /root/.aws/credentials
at com.amazonaws.auth.profile.internal.ProfilesConfigFileLoader.loadProfiles(ProfilesConfigFileLoader.java:45)
at com.amazonaws.auth.profile.ProfilesConfigFile.loadProfiles(ProfilesConfigFile.java:173)
at com.amazonaws.auth.profile.ProfilesConfigFile.<init>(ProfilesConfigFile.java:109)
at com.amazonaws.auth.profile.ProfilesConfigFile.<init>(ProfilesConfigFile.java:89)
at com.amazonaws.auth.profile.ProfileCredentialsProvider.getCredentials(ProfileCredentialsProvider.java:117)
at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:3691)
at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:3647)
at com.amazonaws.services.s3.AmazonS3Client.listObjects(AmazonS3Client.java:626)
at com.vantage.photowall.toolset.s3client.PhotowallAWSS3Client.listKeys(PhotowallAWSS3Client.java:179)
at com.vantage.photowall.toolset.s3client.AWSS3BucketAPIClientCLI.main(AWSS3BucketAPIClientCLI.java:55)
To solve this, simply :
Download crendentials file from https://github.com/aws/aws-sdk-java/blob/master/src/samples/AmazonS3/credentials- wget --no-check-certificate https://github.com/aws/aws-sdk-java/raw/master/src/samples/AmazonS3/credentials
put it in ~/.aws/ directory:
- mkdir ~/.aws/
- mv credentials ~/.aws/credentials
open credentials file and fill access key id and secret access key :
like this:
- # Move this credentials file to (~/.aws/credentials)
- # after you fill in your access and secret keys in the default profile
- # WARNING: To avoid accidental leakage of your credentials,
- # DO NOT keep this file in your source directory.
- [default]
- aws_access_key_id=YOUR_ACCESS_KEY_ID
- aws_secret_access_key=YOUR_SECRET_ACCESS_KEY
Save and close the file.
Run API client program again :)
No comments:
Post a Comment