Created
May 10, 2016 02:44
-
-
Save hrchu/1cb4f9c8c7e3751e76be5917750e7a5b to your computer and use it in GitHub Desktop.
aws java sdk force v2 signing for s3 compatible storage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main(String[] args) { | |
ClientConfiguration clientConf = new ClientConfiguration(); | |
clientConf.withSignerOverride("S3SignerType"); | |
AWSCredentials myCredentials = new BasicAWSCredentials("XX", "DD"); | |
client = new AmazonS3Client(myCredentials, clientConf); | |
client.setEndpoint("http://s3.com"); | |
ObjectMetadata metadata = new ObjectMetadata(); | |
metadata.setContentType("application/octet-stream"); | |
InputStream data = new ByteArrayInputStream("qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq".getBytes(StandardCharsets.UTF_8)); | |
client.putObject("test", "qq", data, metadata); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment