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.
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
The profile name needs to be in square brackets, like so
[justin]
aws_access_key_id = REMOVED-FOR-POST
aws_secret_access_key = REMOVED-FOR-POST
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With