I am developing a web API in .NET6.
I have this problem, "AmazonS3.AmazonS3Exception: AuthMethodNotRecognized", when I try to use a method of the IAmazonS3 interface (ex. ListBucketAsync, CreateBucketAsync etc.).
How can I fix it?
I use the AWSSDK.S3 3.7.8.26 in my project.
Thanks in advance
Please provide a snippet of you code demonstrating how you create an instance of the S3 client object. Also, please elaborate in which environment you call the API (from a Lambda function? from a container? from your local machine?) How do you provide credentials to the API calls?
Hi Dimitry ,
i'm using AWSSDK.S3 "Version =" 3.7.8.26" and I would like to communicate with an external storage to amazon (S3 compatible)
public AppConfiguration()
{
_awsAccessKey = appSetting["AwsAccessKey"];
_awsSecretAccessKey = appSetting["AwsSecretAccessKey"];
_restEndPoint = appSetting["RestEndPoint"];
_as3Config = new AmazonS3Config
{
ServiceURL = _restEndPoint
};
_basicAwsCredentials = new BasicAWSCredentials(_awsAccessKey, _awsSecretAccessKey);
}
public ObjectStorage(IAppConfiguration appConfiguration)
{
_aws3Services = new S3ApiGateway(appConfiguration.BasicCredentials,appConfiguration.As3Config);
}
public List<string> GetBucketsList()
{
return _aws3Services.GetBucketsListAsync().Result;
}
Please provide a snippet of you code demonstrating how you create an instance of the S3 client object. Also, please elaborate in which environment you call the API (from a Lambda function? from a container? from your local machine?) How do you provide credentials to the API calls?
Hi Dimitry , i'm using AWSSDK.S3 "Version =" 3.7.8.26" and I would like to communicate with an external storage to amazon (S3 compatible)
public AppConfiguration() { _awsAccessKey = appSetting["AwsAccessKey"]; _awsSecretAccessKey = appSetting["AwsSecretAccessKey"]; _restEndPoint = appSetting["RestEndPoint"]; _as3Config = new AmazonS3Config { ServiceURL = _restEndPoint }; _basicAwsCredentials = new BasicAWSCredentials(_awsAccessKey, _awsSecretAccessKey); }
public ObjectStorage(IAppConfiguration appConfiguration) { _aws3Services = new S3ApiGateway(appConfiguration.BasicCredentials,appConfiguration.As3Config);
public List<string> GetBucketsList() { return _aws3Services.GetBucketsListAsync().Result; }
public async Task<List<string>> GetBucketsListAsync() { try { var getPutBucketResponse= await GetBucketsList(); return getPutBucketResponse.Buckets.Select(s=> s.BucketName).ToList(); } catch (Exception e) { throw e; } }