1

Hi I deployed my WEB API project to Heroku but I get an AWS exception 'No RegionEndpoint or ServiceURL configured'

I tried to add 'region' and 'aws_default_region' to heroku's app enviromental variables and set them to 'eu-north-1' but it didn't help. Also I added these lines to my web.config file under configuration but I still get that exception:

<appSettings>
    <add key="AWSRegion" value="eu-north-1"/>
</appSettings>
<aws region="eu-north-1"/>

I can't create my own aws client and set the region programatically since I am creating the service in my startup class like so:

services.AddAWSService<IAmazonS3>();

In local build it seems I just added 'region' to my .aws/crediantials file and it worked, but I can't do that in Heroku.

Thank you fin advance.

BeginnerSirius
  • 117
  • 1
  • 8

1 Answers1

5

Looks like you are building a ASP.NET Core application which doesn't use web.config other then some IIS integration. You should either put the region in the appsettings.json file like shown here https://aws.amazon.com/blogs/developer/configuring-aws-sdk-with-net-core/ or set the environment variable AWS_REGION to your desired region.

Norm Johanson
  • 2,964
  • 14
  • 13
  • Thank you Norm, really appreciate the work you do at AWS! I got it working by following the link you provided. – BeginnerSirius Apr 16 '20 at 20:23
  • Excellent! Glad that helped. – Norm Johanson Apr 16 '20 at 21:38
  • The issue I found with this is that I needed to use the DryRun() method from AmazonEC2Client, which is not available with IAmazonEC2. If I try to use the CreateServiceClient() with AmazonEC2Client, it fails to create the client, throwing a "Object not set to a reference" error :( – Kappacake Apr 22 '21 at 09:50
  • Interesting. I can't think of a reason why DryRun shouldn't be on the IAmazonEC2 interface. Speaking as one of the maintainers for the AWS .NET SDK I think that was just a miss on our part. Would you mind opening issue on our repo to get the DryRun method added to the interface? https://github.com/aws/aws-sdk-net – Norm Johanson Apr 24 '21 at 01:17