Opensearch repository-s3 plugin trouble with AWS region after upgrade

Hi!

Аfter updating OpenSearch 2.8.0 to 2.9.0, the functionality of repository-s3 plugin weird.

Here is the log I get after requesting to view snapshots in backet (region eu-central-1):

{"error":{"root_cause":[{"type":"s3_exception","reason":"s3_exception: The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint. (Service: S3, Status Code: 301, Request ID: C7H33WRXPBJHZ13W, Extended Request ID: zGWpu6uRVVQ4jLHwddWZpji1Rhlo57BBIFbqrUWk1r5kfGyR+sEwzsuolCq9cZ2mAqbKKZcWiHA=)"}],"type":"repository_exception","reason":"[backup.opensearch] Unexpected exception when loading repository data","caused_by":{"type":"s3_exception","reason":"s3_exception: The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint. (Service: S3, Status Code: 301, Request ID: C7H33WRXPBJHZ13W, Extended Request ID: zGWpu6uRVVQ4jLHwddWZpji1Rhlo57BBIFbqrUWk1r5kfGyR+sEwzsuolCq9cZ2mAqbKKZcWiHA=)"}},"status":500}

On the part of AWS S3 Bucket to which the cluster is connected, there were no changes. Credentials worked fine.

Аfter trying to add an S3 bucket with some different combinations I saw the following log:

"reason": "The authorization header is malformed; the region 'eu-central-1' is wrong; expecting 'us-east-1' (Service: S3, Status Code: 400, Request ID: BETMPMA86J7Q7CTH, Extended Request ID: vzSJCEIEwoZRRFkiEsKX7n/tk86XEkUnHFN28M1qxvQlrvHf7/X7NBrLSDlVpyupRoayeSfJUb8=)"

Why i can’t use my bucket in eu-central-1 region after upgrade to 2.9.0 version of Opensearch?

2.9 has changed discovery-ec2 and repository-s3 plugins to AWS SDK v2. Add amazon_s3_region to gradle check CI/CD · Issue #3615 · opensearch-project/opensearch-build · GitHub
Did you try setting

s3.client.default.region: