Amazon s3.NET SDK, the bucket you are trying to access must be resolved using the endpoint

I use amazon.NET SDK in widows phone 8 application to upload images, the code worked fine. Now i get an exception

The bucket you are trying to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.

I updated to the latest SDK 2.0.2.2, has anything changed with the update?

My code

string awsID = "myid"; string secretKey = "mysecretkey"; try{ AmazonS3Client s3Client = new AmazonS3Client(awsID, secretKey,RegionEndpoint.USWest1); string s=""; if (IsolatedStorageSettings.ApplicationSettings.Contains("selectedphoto1")) { s = IsolatedStorageSettings.ApplicationSettings["selectedphoto1"] as string; } var InputStream = App.GetResourceStream(new Uri("appname;component/Assets /call.png", UriKind.Relative)); var request = new PutObjectRequest() { BucketName = "mybucketname", ContentType="image/png", Key=s+".jpg", InputStream = myFileStream, }; await s3Client.PutObjectAsync(request); } catch (Exception ex) { Console.Write(ex.InnerException); } 
+6
source share
1 answer

This is due to the wrong bucket area. Check your region on the Amazon console on the S3 bucket and configure some of the configuration files and code

For example: - AmazonS3Client s3Client = new AmazonS3Client (awsID, secretKey, RegionEndpoint.APNortheast1);

+5
source

Source: https://habr.com/ru/post/958620/


All Articles