In a C# project being executed on the development machine, I want to get the AWS region for my current AWS profile. I've seen the credential and profile resolution documentation and would rather not reimplement this if I can avoid it. In bash I would use:
Region=$(aws configure get region)
Is there some call in the AWS .Net SDK to do the equivalent?
Once you have created an AWS client object for some service, you can access the region for the default user through the Config property of the client object.
This two-line example creates a client using the default credentials and then displays the RegionEndpoint value on the console:
var client = new AmazonS3Client();
Console.WriteLine(client.Config.RegionEndpoint);
This code uses the AWS SDK for .NET version 3.7 and .NET Core 5. Here is a link to the API documentation for the IClientConfig interface so you can see what other information is available: IClientConfig