Can not find credentials in AWS .NET SDK

I am trying to create a web app with the AWS .NET SDK. I am adding my credentials in using the credential file. In my web.config it looks like this.

<add key="AWSProfileName" value="profilename" />
<add key="AWSProfilesLocation" value="C:\AWS\credentials" />
<add key="AWSRegion" value="eu-west-1" />

My credentials file itself looks like this and it is located at this path C:\AWS, it is saved under the title credentials.txt

[myname]
aws_access_key_id = my key
aws_secret_access_key = my s key

According to this document http://docs.aws.amazon.com/AWSSdkDocsNET/V2/DeveloperGuide/net-dg-config-creds.html this is set up correctly. I have set up the profile with an IAM Administrator role and the keys both match the keys given upon creation.

However when I try and create an EC2Client object I am greeted with this error

Unable to find credentials

Exception 1 of 4:

System.ArgumentException: App.config does not contain credentials information. Either add the AWSAccessKey and AWSSecretKey or AWSProfileName.

at Amazon.Runtime.StoredProfileAWSCredentials..ctor(String profileName, String profilesLocation) in d:\Jenkins\jobs\build-sdk-v2\workspace\sdk\src\AWSSDK_DotNet35\Amazon.Runtime\AWSCredentials.cs:line 318

at Amazon.Runtime.EnvironmentAWSCredentials..ctor() in d:\Jenkins\jobs\build-sdk-v2\workspace\sdk\src\AWSSDK_DotNet35\Amazon.Runtime\AWSCredentials.cs:line 590

at Amazon.Runtime.FallbackCredentialsFactory.b__1() in d:\Jenkins\jobs\build-sdk-v2\workspace\sdk\src\AWSSDK_DotNet35\Amazon.Runtime\AWSCredentials.cs:line 1117

at Amazon.Runtime.FallbackCredentialsFactory.GetCredentials(Boolean fallbackToAnonymous) in d:\Jenkins\jobs\build-sdk-v2\workspace\sdk\src\AWSSDK_DotNet35\Amazon.Runtime\AWSCredentials.cs:line 1137

I know I can hardcode the keys into the web.config or use the SDK store but I kind of need it to be done this by a credentials file. Why can my code not find my credentials file?

Answers


Credentials.txt needs to be converted from a text file to a generic windows file (.file) for the application to recognise it.


Need Your Help

Access MAMP's MySQL from Terminal

php mysql bash terminal mamp

I want to practice using SQL instead of phpMyAdmin.

Creating a dynamic (video) Overlay on Google Maps on Android 2.1

android video google-maps mjpeg overlays

I'm trying to create a map overlay for displaying a video stream (MJPEG) on top of a Mapview.