Can't create Amazon Web Services (AWS) credentials object

.net, amazon-dynamodb, amazon-web-services, c#, sdk

Solution

Your config section

<add key="AWSProfilesLocation" value="C:\code\dynamodb\credentials" />

should be

<add key="AWSProfilesLocation" value="C:\code\dynamodb\credentials\filename.json" /> 

for it to work. In other words specify the file name in the Profile location.

If you using newer SDK then using the following would work as well:

<configSections>
   <section name="aws" type="Amazon.AWSSection, AWSSDK" />
</configSections>
<aws profileName="YourProfileName" profilesLocation="C:\aws\credentials\aws-credentialfile.json" region="xx-xxxx-x" />

Nachi

Problem

I'm trying to get started developing against the local Dynamo DB service. The first step is simply creating a client: ``` var storedAWSCreds = new StoredProfileAWSCredentials(); ``` This throws an exception: App.config does not contain credentials information. Either add the AWSAccessKey and AWSSecretKey or AWSProfileName My app.config has the needed properties: ``` <add key="AWSProfileName" value="justin"/> <add key="AWSProfilesLocation" value="C:\code\dynamodb\credentials"/> ``` The credentials profile file: ``` justin aws_access_key_id = REMOVED-FOR-POST aws_secret_access_key = REMOVED-FOR-POST ``` At this point I thought I would try one of the other overloaded methods and explicitly tell the constructor what the parameters should be: ``` var storedAWSCreds = new StoredProfileAWSCredentials("justin", @"C:\code\dynamodb\credentials"); ``` Again, the same exception. Okay, the exception says I can provide the credentials directly in my config so I tried that: ``` <add key="AWSAccessKey" value="REMOVED-FOR-POST"/> <add key="AWSSecretKey" value="REMOVED-FOR-POST"/> ``` Again, the same exception. How can I get the `StoredProfileAWSCredentials` object created? I'm clearly missing something obvious or their exception messages are incorrect. I will point out, I can create a `BasicAWSCredentials` object by specifying the access key and secret key in the constructor: ``` var basicAWSCreds = new BasicAWSCredentials("REMOVED-FOR-POST", "REMOVED-FOR-POST"); ``` But, at some point I would prefer to not have it hard-coded in my application.

Original source