Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to load AWS credentials from the /AwsCredentials.properties file on the classpath

Using this code for setting the class path

AWSCredentialsProvider credentialsProvider = new ClasspathPropertiesFileCredentialsProvider(); ec2 = new AmazonEC2Client(credentialsProvider); 

Below is the format for AwsCredentials.properties file

# Fill in your AWS Access Key ID and Secret Access Key # http://aws.amazon.com/security-credentials accessKey = keyHere secretKey = secretKeyHere 

Below is the exception I am getting

Exception in thread "main" com.amazonaws.AmazonClientException: Unable to load AWS credentials from the /AwsCredentials.properties file on the classpath      at com.amazonaws.auth.ClasspathPropertiesFileCredentialsProvider.getCredentials(ClasspathPropertiesFileCredentialsProvider.java:81)     at com.amazonaws.services.ec2.AmazonEC2Client.invoke(AmazonEC2Client.java:8359) 
like image 782
Crew HaXor Avatar asked Mar 23 '14 08:03

Crew HaXor


People also ask

Could not connect to repository unable to load AWS credentials from any provider in the chain -> Help 1?

You are getting this exception because your AWS SDK is unable to load your credentials. What you should do is goto Preferences then goto AWS and add your secret key and access key. So that your project can retrieve both keys.

Can I use AWS SDK without credentials?

To make requests to Amazon Web Services using the AWS SDK for Java, you must use cryptographically-signed credentials issued by AWS. You can use programmatic access keys or temporary security credentials such as AWS IAM Identity Center (successor to AWS Single Sign-On) or IAM roles to grant access to AWS resources.


1 Answers

I made the connection using a different approach:

BasicAWSCredentials credentials = new BasicAWSCredentials(ACCESS_KEY, SECRET_KEY); AmazonDynamoDBClient client = new AmazonDynamoDBClient(credentials).withRegion(Regions.US_EAST_1); DynamoDB dynamoDB = new DynamoDB(client); 

The access key and the secret key can be created in the Identity and Access Management console. I hope it helps...

like image 151
gbonesso Avatar answered Sep 29 '22 01:09

gbonesso