Can't use Spaces via Amazon S3 SDK

February 10, 2018 136 views
API Java Ubuntu

I'm trying to perform a PUT operation towards Spaces using AWS S3 Java SDK, but I keep getting the same error.

Here's the definition of the client:

    public AmazonS3 spaces() {
        BasicAWSCredentials credentials = new BasicAWSCredentials(...);
        return AmazonS3ClientBuilder.standard().
                withCredentials(new AWSStaticCredentialsProvider(credentials)).
                withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration("", "ams3")).

Here's usage:

spaces.putObject("bucketname", fullPath, tempFile);

And the error is: Bad request (Service: Amazon S3; Status Code: 400; Error Code: 400 Bad request; Request ID: null; S3 Extended Request ID: null)

SDK version:


I tried to replace AwsClientBuilder.EndpointConfiguration("", "ams3") with AwsClientBuilder.EndpointConfiguration("", "ams3"), but it also didn't work.

And when I try to GET the file, I surprisingly get a different error: null (Service: Amazon S3; Status Code: 403; Error Code: SignatureDoesNotMatch; Request ID: ...; S3 Extended Request ID: ...)

Although I'm pretty sure that I've specified key and secret correctly: I double-checked it.

Be the first one to answer this question.