Does Linode Object Storage Supports AWS SDK Version 2 For Java?

Does linode object storage supports the AWS SDK Version 2 for Java?

I have written the following code:
```java
public void testLinodeObjectStorage() {

AwsCredentials awsBasicCredentials = AwsBasicCredentials
        .create("access_key", "secret key");

S3Client s3Client = S3Client.builder()
        .credentialsProvider(() -> awsBasicCredentials)
        .region(Region.AP_SOUTH_1)
        .build();

CreateBucketRequest request = CreateBucketRequest.builder()
        .bucket("test-202405011")
        .build();

CreateBucketResponse bucket = s3Client.createBucket(request);

}

But I get the following error when running the code:
software.amazon.awssdk.services.s3.model.S3Exception: The AWS Access Key Id you provided does not exist in our records. (Service: S3, Status Code: 403, Request ID: KZYKPEG85GG2Q5Z0

I checked my access key and secret key and they were correct!.

2 Replies

I managed to make it work (perform read and put operations):

S3Client.builder()
.credentialsProvider(() -> awsBasicCredentials)
.endpointOverride(new URI("https://ap-south-1.linodeobjects.com"))
.region(Region.AP_SOUTH_1)
.build();

By default, the client tries to connect to AWS.
We need to change this default behavior with the endpointOverride.

I can now perform read and put operations on my buckets using the AWS SDK V2.
But I still cannot create a bucket via Java code for the region ap_south_1

I know that our Object Storage is compatible with SDKs for both Python and PHP, but I wasn't able to find a guide for Java.

I did find a previous post on our Community Site that provides some additional information that could help.

This link to an example of complete Java syntax for creating a bucket may also help. If you can try updating that with the specifics for your use case and provide detailed examples of any errors you're seeing at that time, someone from our Community may be able to provide more help in moving you in the right direction.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct