Cannot find credentials in AWS.NET SDK

I am trying to create a web application using the AWS.NET SDK. I add my credentials when using a 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 credential file looks like this and is located on this path C: \ AWS, it is saved under 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 configured correctly. I installed a profile with the IAM administrator role, and the keys match the keys specified during creation.

However, when I try to create an EC2Client object, I welcome this error

Unable to find credentials

Exception 1 out of 4:

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

in Amazon.Runtime.StoredProfileAWSCredentials..ctor (String profileName, String profilesLocation) in d: \ Jenkins \ work \ build-SDK-v2 \ workspace \ SDK \ SRC \ AWSSDK_DotNet35 \ Amazon.Runtime \ AWSCredentials.cs: line 318

in Amazon.Runtime.EnvironmentAWSCredentials..ctor () in d: \ Jenkins \ work \ build-KFOR-v2 \ workspace \ SDK \ SRC \ AWSSDK_DotNet35 \ Amazon.Runtime \ AWSCredentials.cs: line 590

in Amazon.Runtime.FallbackCredentialsFactory.b__1 () in d: \ Jenkins \ work \ build-KFOR-v2 \ workspace \ SDK \ SRC \ AWSSDK_DotNet35 \ Amazon.Runtime \ AWSCredentials.cs: line +1117

at Amazon.Runtime.FallbackCredentialsFactory.GetCredentials (Boolean fallbackToAnonymous) at d: \ Jenkins \ work \ build-KFOR-v2 \ workspace \ SDK \ SRC \ AWSSDK_DotNet35 \ Amazon.Runtime \ AWSCredentials.cs: line One thousand one hundred seven

I know that I can hard-code the keys in web.config or use the SDK storage, but I need this to be done using a credential file. Why can't my code find my account file?

+6
source share
1 answer

Credentials.txt must be converted from a text file to a common Windows file (.file) so that the application can recognize it.

+3
source

All Articles