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.
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.
Our configuration: 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:
"AWS": {
"Region": "ap-southeast-2"
}
We don't have any web.config or other json config file.
We tried to create a credential file as:
[name of my IAM profile]
aws_access_key_id=accesskey
aws_secret_access_key=secretkey
region=ap-southeast-2
But we didn't find how we can use it.
We also try to run the project with the dotnet core run command and to specify some environment variables as :
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$
But same error.
Program.cs file:
var host = new WebHostBuilder()
.UseKestrel(options => options.AddServerHeader = false)
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.UseUrls("http://*:9000")
.CaptureStartupErrors(true)
.Build();
host.Run();
Startup file (first function):
public Startup(IHostingEnvironment env) {
// Configuration override https://learn.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);
}
Here is our question: Where or how are configured the credentials of our project?
Thank you in advance for your answer.