Accessing Walrus programatically (Java) using AWS S3 SDK / JetS3t

684 views Asked by At

I was looking to find ways to access Walrus (Eucalyptus) using AWS SDK for Java. I'm familiar with using the AWS SDK to connect to Amazon S3 programatically using my AWS credentials. However, when I Googled to check if Walrus is accessible using AWS SDK, I came to know that there are issues and the only way out is to use JetS3t instead.

Has anybody played with JetS3t and Walrus before ?
Is JetS3t a reliable solution ?
Can I mirror whatever I can do in the AWS SDK against S3, with JetS3t and Walrus ?

Thanks in advance.

3

There are 3 answers

0
HarshitGupta On

I used the AWS SDK and it worked wonderfully for me. Here's a sample code I wrote for uploading a file on my local drive to Walrus. Hope you find it useful.

    AmazonS3 s3 = new AmazonS3Client(new AWSCredentials() {
        @Override
        public String getAWSSecretKey() {
            return "G0WewmHyE5KYaGcVWvSAQrsBsPnJb2qQOPIIc74h";
        }

        @Override
        public String getAWSAccessKeyId() {
            return "4OFCOBFGPGVINNR7H6TMG";
        }
    });
    s3.setEndpoint("http://10.14.99.97:8773/services/Walrus/");
    byte[] bytes = convertToByteArray("/home/harshit/Desktop/poster.jpg"); // function written by me for extracting byte stream out of a local file
    ByteArrayInputStream is = new ByteArrayInputStream(bytes);
    PutObjectRequest request = new PutObjectRequest("skg", "foo.jpg", is, metaData);
    s3.putObject(request);
0
jeremyjjbrown On

You can use the same exact code to access your walrus as s3. You will however need to point jets3t to your walrus instance by including a properly edited the jets3t.properties file in your build.

0
Deependra Shekhawat On

I know this is an old question, asked long back but just wanted to give a quick update that AWS JAVA SDK 1.4.0 works with Walrus, if you are looking for a sample code that explains how we could use AWS JAVA SDK 1.4.0 against Walrus , please see

https://gist.github.com/jeevanullas/5351730#file-walrustest-java

This works just fine against Eucalyptus 3.2.2 (current stable release) and 3.3.0 (current development release)

Hope this was useful.