title: How to specify AWS credentials in C# .NET core console program
body: <p>I am trying to test a .NET core console program to publish a message to SNS. As I had issues trying to get it to work in Lambda, I want to try it in a non-Lambda environment.  In Lambda, security is covered by the role, but in a console program, I presume that I have to specify my access key and secret somehow. </p>
  
  <p>I've read this page: <a href="http://docs.aws.amazon.com/sdk-for-net/v3/developer-guide/net-dg-config-creds.html#net-dg-config-creds-sdk-store" rel="noreferrer">http://docs.aws.amazon.com/sdk-for-net/v3/developer-guide/net-dg-config-creds.html#net-dg-config-creds-sdk-store</a>, but still totally confused. </p>
  
  <p>I'm running on my local development computer, not an EC2 instance. No intent to go to production with this, just trying to test some code. </p>
  
  <p>I'm on Visual Studio 2015, .NET Core 1.0. I've used Nuget to get the following:
    "AWSSDK.Extensions.NETCore.Setup": "3.3.3",
    "AWSSDK.SimpleNotificationService": "3.3.0.23",</p>
  
  <p>Based on the answer to <a href="https://stackoverflow.com/questions/43053495/how-to-set-credentials-on-aws-sdk-on-net-core">How to set credentials on AWS SDK on NET Core?</a> I created the /user/.aws/credentials file (assuming credentials was the file name and not the directory name). </p>
  
  <p>But that question/answer doesn't address how to actually use this file.  The code I'm running is below. </p>
  
  <pre><code>    public static void Main(string[] args)
      {
          Console.WriteLine("Started");
          //var awsCredentials = new Amazon.Runtime.AWSCredentials()
          var client = new Amazon.SimpleNotificationService.AmazonSimpleNotificationServiceClient(Amazon.RegionEndpoint.EUWest2);
          //var client = new Amazon.SimpleNotificationService.AmazonSimpleNotificationServiceClient(awsCredentials, Amazon.RegionEndpoint.EUWest2);
          //Amazon.SimpleNotificationService.Model.PublishResponse publishResp = null;
          SendMessage(client).Wait();
          Console.WriteLine("Completed call to SendMessage: Press enter to end:");
          Console.ReadLine(); 
      }
  </code></pre>
  
  <p>The error I'm getting on the new client is: </p>
  
  <pre><code>An unhandled exception of type 'Amazon.Runtime.AmazonServiceException' occurred in AWSSDK.Core.dll
  
  Additional information: Unable to find credentials
  </code></pre>
  
  <p>I see there is a way to pass an AWSCredentials object to that constructor, but I don't understand how to build it.   Amazon.Runtime.AWSCredentials is an abstract class, so I can't use it in a "new" statement. </p>