title: How to set AWS credentials with .net Core
body: <p>I have to debug an existing project about .net Core and AWS.
  Our project runs well on our AWS instance but we can't run the project in local.</p>
  
  <p>Firstly we got the AmazonServiceException: Unable to find credentials, but now we have the message: AmazonClientException: No RegionEndpoint or ServiceURL configured. I think it's better.</p>
  
  <p><strong>Our configuration:</strong>
  In our application we have 3 appsettings.{env.EnvironmentName}.json (Development, Local and Production). We know by default VS use the development file.
  In our development appsettings file we have no AWS object but in the local appsettings file we have only that: </p>
  
  <pre><code>"AWS": {
        "Region": "ap-southeast-2"
  }
  </code></pre>
  
  <p>We don't have any web.config or other json config file.</p>
  
  <p>We tried to create a credential file as:</p>
  
  <pre><code>[name of my IAM profile]
  aws_access_key_id=accesskey
  aws_secret_access_key=secretkey
  region=ap-southeast-2
  </code></pre>
  
  <p>But we didn't find how we can use it.</p>
  
  <p>We also try to run the project with the dotnet core run command and to specify some environment variables as :</p>
  
  <pre><code>export AWS_Region=ap-southeast-2
  export AWS_ACCESS_KEY_ID=id
  export AWS_SECRET_ACCESS_KEY=secret
  export AWS_SESSION_TOKEN=token
  export 
  AWS_CREDENTIAL_FILE=/Users/user/Developer/exemple/nameproject/G$
  </code></pre>
  
  <p>But same error.</p>
  
  <p>Program.cs file:</p>
  
  <pre><code>var host = new WebHostBuilder()
      .UseKestrel(options =&gt; options.AddServerHeader = false)
      .UseContentRoot(Directory.GetCurrentDirectory())
      .UseIISIntegration()
      .UseStartup&lt;Startup&gt;()
      .UseUrls("http://*:9000")
      .CaptureStartupErrors(true)
      .Build();
  
  host.Run();
  </code></pre>
  
  <p>Startup file (first function):</p>
  
  <pre><code>public Startup(IHostingEnvironment env) {
          // Configuration override https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration
          var builder = new ConfigurationBuilder()
              .SetBasePath(env.ContentRootPath)
              .AddJsonFile($"appsettings.{env.EnvironmentName}.json", false, true)
              .AddEnvironmentVariables();
  
          Configuration = builder.Build();
  
          // Shared startup configurator
          CommonStartup = new CommonStartup(env, Configuration);
      }
  </code></pre>
  
  <p><strong>Here is our question:</strong>
  Where or how are configured the credentials of our project?</p>
  
  <p>Thank you in advance for your answer.</p>