Is Swift Object Storage compatible with the "standard" aws sdk (v. 2.0) ?
Here my code to create a S3Client:
AwsBasicCredentials awsCreds = AwsBasicCredentials.create(
"accessKeyId",
"secretAccessKey");
client = S3Client.builder()
.credentialsProvider(StaticCredentialsProvider.create(awsCreds))
.region(???)
.build();
I found my accessKeyId and secretAccessKey, but I can't set a proper vaue for "region", because it is NOT a string, but an instance of software.amazon.awssdk.regions.Region class, that has a predefined values only (I think I should pass "gra").
Does that mean I cannot use this sdk? Do I have to use the REST API?
Hi, solved by myself!
Use this code:
Region gra = Region.of("gra");
client = S3Client.builder()
.region(gra)
.endpointOverride(URI.create("https://s3.gra.cloud.ovh.net"))
.credentialsProvider(StaticCredentialsProvider.create(awsCreds))
.build();
Yes, you can use the AWS SDK for Java (2.x) with OVHcloud Object Storage, but only if you use the S3-compatible endpoint, not pure Swift.
OVHcloud provides S3-compatible APIs for Object Storage, so standard tools and SDKs (like AWS SDK) will work — but you must configure them correctly.
👉 The key points:
-
Use the S3 endpoint format:
https://s3.<region>.cloud.ovh.net - Set the region as a valid AWS SDK region object (even if OVH uses custom names like
gra, you still need to map it properly in the SDK). - Most importantly, override the endpoint URL in the client config — otherwise it will try to connect to AWS instead of OVH.
💡 Also note:
- OVH’s Swift storage is older and not fully aligned with AWS SDK expectations.
- For new projects, OVH themselves recommend using S3-compatible Object Storage instead of Swift for better compatibility and fewer issues.