AWS java SDK manually set signature version

Viewed 6807

I'm trying to access a blob store service which is on top of AWS S3. It supports AWS SDK and it's signature version 2.

I'm using code here to access the this service.

Is it possible to manually set the signature version of the request made by AWS SDK ?

According to this page

AWS currently supports two signature versions: signature version 2 and signature version 4, which are covered in this section. Most services support version 4, and if a service supports version 4, we strongly recommend that you use that version.

I'm unable to find how to set the signature version to 2 or 4 manually.

2 Answers

as of

aws-java-sdk-core-1.11.163

SDKGlobalConfiguration.ENABLE_S3_SIGV4_SYSTEM_PROPERTY is deprecated.

I used the below code to call using signature_version='s3'

private static ClientConfiguration config = new ClientConfiguration();

static {
    config.setProtocol(Protocol.HTTP);
    config.setSignerOverride("S3SignerType");
}
private static AmazonS3 s3client = AmazonS3ClientBuilder
    .standard()
    .withClientConfiguration(config)
    .withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration("endpoint", null))
    .withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials("access_key_id", "secret_Key")))
    .build();
Related