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 need it to be done this way. Why can my code not find my credentials file?
Credentials.txt needs to be converted from a text file to a generic windows file (.file) for the application to recognise it.
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