4

I have downloaded the Amazon AWS SDK for C#, I have no problem accessing the EC2 part of our private cloud running Eucalyptus, I can list, Images, Instances, Zones ...

This is working fine :

AmazonEC2 ec2 = AWSClientFactory.CreateAmazonEC2Client("abcdefghijklmnopqrstuvwxyz1234567890", "abcdefghijklmnopqrstuvwxyz1234567890", new AmazonEC2Config().WithServiceURL("http://10.140.54.12:8773/services/Eucalyptus"));

DescribeInstancesRequest ec2Request = new DescribeInstancesRequest();
try
{
    DescribeInstancesResponse ec2Response = ec2.DescribeInstances(ec2Request);
    int numInstances = 0;
    numInstances = ec2Response.DescribeInstancesResult.Reservation.Count;
    textBoxInstancesLog.AppendText("You have " + numInstances + " running instances");
    textBoxInstancesLog.AppendText(ec2Response.ToString());
}
catch (Exception ex)
{
    MessageBox.Show(ex.ToString());
}

But I need to access the Walrus (S3) part of our Cloud. This is how I try to access the Walrus, the code is almost identical, but with this call I will get an exception.

This is not working:

AmazonS3 s3 = AWSClientFactory.CreateAmazonS3Client("abcdefghijklmnopqrstuvwxyz1234567890", "abcdefghijklmnopqrstuvwxyz1234567890", new AmazonS3Config().WithServiceURL("http://10.140.54.12:8773/services/Walrus"));
ListBucketsRequest s3Request = new ListBucketsRequest();
try
{
    ListBucketsResponse s3Response = s3.ListBuckets(s3Request);
    textBoxS3Log.AppendText(s3Response.ToString());
}
catch (Exception ex)
{
    MessageBox.Show(ex.ToString());
}

I will receive this exception :

System.Net.WebException: The remote name could not be resolved: 'http'
   at Amazon.S3.AmazonS3Client.processRequestError(String actionName, HttpWebRequest request, WebException we, HttpWebResponse errorResponse, String requestAddr, WebHeaderCollection& respHdrs, Type t, Exception& cause)
   at Amazon.S3.AmazonS3Client.handleHttpWebErrorResponse(S3Request userRequest, WebException we, HttpWebRequest request, HttpWebResponse httpResponse, Exception& cause, HttpStatusCode& statusCode)
   at Amazon.S3.AmazonS3Client.getResponseCallback[T](IAsyncResult result)
   at Amazon.S3.AmazonS3Client.endOperation[T](IAsyncResult result)
   at Amazon.S3.AmazonS3Client.ListBuckets(ListBucketsRequest request)
   at IAASClient.FormMain.buttonS3Test_Click(Object sender, EventArgs e) in X:\work\IAASClient\FormMain.cs:line 107

From Eucalyptus site :

Eucalyptus implements an IaaS (Infrastructure as a Service) private cloud that is accessible via an API compatible with Amazon EC2 and Amazon S3

What am I missing ?

Note: The same code work flawlessly with Amazon S3, the problem is to access Eucalyptus Walrus.

pallaire
  • 113
  • 1
  • 9
  • 3
    "Eucalyptus Walrus" would be a good name for a band. (Sorry I can't help with the question, though!) – ewall Jun 08 '11 at 17:33

2 Answers2

2

You can access Walrus using the current Amazon AWS SDK for C#. It just doesn't work quite the way you would expect if your Walrus URL contains a path component like...

http://eucalyptus.test.local:8773/services/Walrus

Here's how to setup the AmazonS3Client and a request. Notice that the path portion of the service url gets put into the bucketname.

I've tested this setup with presigned urls and with the DeleteObjectRequest. I'm using version 1.5.19.0 of the SDK from https://github.com/aws/aws-sdk-net

var config = new Amazon.S3.AmazonS3Config
                {
                    ServiceURL = "eucalyptus.test.local:8773",
                    CommunicationProtocol = Protocol.HTTP
                };

            var client = new Amazon.S3.AmazonS3Client("XXXXXXXXXXXXXXXXXXKEY", "XXXXXXXXXXXXXXXXXXXXXXXXXXXXSECRET", config);
            var response = client.GetPreSignedURL(
                new GetPreSignedUrlRequest().WithBucketName("services/Walrus/BucketName")
                                            .WithExpires(DateTime.UtcNow.AddHours(10))
                                            .WithProtocol(Protocol.HTTP)
                                            .WithVerb(HttpVerb.PUT)
                                            .WithKey("video.mp4"));
Ben Oram
  • 21
  • 3
0

AWSSDK for .NET doesn't seem to understand port numbers in ServiceUrls... I just wrote a patch for this in the SimpleDB client code the other day, but I haven't actually looked at it in the S3 client...

You could try temporarily hosting you Walrus service on port 80 and retesting to verify if this is the problem.

Scrappydog
  • 2,864
  • 1
  • 21
  • 23
  • It does not look like this would be the problem. I was able to go one step farther by removing the http:// at the beginning of the ServiceURL. But now the problem is that I cant connect ... .LoginException: Login Failure ! My guess would be that AWS SDK is not using the :8773/services/Walrus into the signing part ! So I am still searching. – pallaire Jun 10 '11 at 17:23