0

This code retrieves the buckets of a Amazon S3-compatible storage (not Amazon AWS but the Zadara compatible cloud storage) and IT WORKS:

import boto3
from botocore.client import Config

session = boto3.session.Session( )

s3_client = session.client(
    service_name            = 's3',
    region_name             = 'IT',
    aws_access_key_id       = 'xyz', 
    aws_secret_access_key   = 'abcedf',
    endpoint_url            = 'https://nothing.com:443',
    config                  = Config(signature_version='s3v4'),
)

print('Buckets')
boto3.set_stream_logger(name='botocore')
print(s3_client.list_buckets())

I am trying to use the same method to access S3 via C# and AWS SDK, anyway I always obtain the error "The request signature we calculated does not match the signature you provided. Check your key and signing method.".

    AmazonS3Config config = new AmazonS3Config();
    config.AuthenticationServiceName = "s3";
    config.ServiceURL = "https://nothing.com:443";
    config.SignatureVersion = "s3v4";
    config.AuthenticationRegion = "it";

    AmazonS3Client client = new AmazonS3Client(
        "xyz",
        "abcdef",
        config);
    ListBucketsResponse r = await client.ListBucketsAsync();

What can I do? Why it is not working? I can't get a solution.

I tried also to trace debug infos:

Python

boto3.set_stream_logger(name='botocore')

C#

AWSConfigs.LoggingConfig.LogResponses = ResponseLoggingOption.Always;
AWSConfigs.LoggingConfig.LogMetrics = true;
AWSConfigs.LoggingConfig.LogTo = Amazon.LoggingOptions.SystemDiagnostics;
AWSConfigs.AddTraceListener("Amazon", new System.Diagnostics.ConsoleTraceListener());

but for C# it is not logging the whole request.

Any suggestion?

max_s
  • 83
  • 1
  • 8
  • Why did you omit `use_ssl = True` and `verify = True` with C#? Is it `True` by default? – veben Dec 02 '21 at 09:38
  • @veben it works also without (ssl is valid and use_ssl is given py protocol string https://). I removed it in the question to avoid confusion. – max_s Dec 02 '21 at 10:09

0 Answers0