Search This Blog

Thursday, August 2, 2012

It is possible to use Cloud Files (CF) on the private ServiceNet from Cloud Servers

In the Rackspace API documentation [1] there is information how to authenticate yourself before you can start sending request to use Cloud files. With the API you can easily for example store a file or get a containers listing.

# to authenticate your self 
$ curl -D - -H "X-Auth-User: myuser" -H "X-Auth-Key: mykey"
HTTP/1.1 204 No Content
Server: Apache/2.2.3 (Red Hat)
vary: X-Auth-User,X-Auth-Key,X-Storage-User,X-Storage-Pass
Cache-Control: s-maxage=63832
Content-Type: text/xml
Date: Wed, 01 Aug 2012 14:04:51 GMT
X-Auth-Token: 22222222
X-Storage-Token: 111111111111
Connection: Keep-Alive
Content-Length: 0

# get listing 
$ curl -X GET -D - -H "X-Auth-Token: myusr"
HTTP/1.1 200 OK
X-Account-Object-Count: 2
X-Timestamp: 1341923250.51682
X-Account-Bytes-Used: 3210734282
X-Account-Container-Count: 2
Accept-Ranges: bytes
Content-Length: 18
Content-Type: text/plain; charset=utf-8
X-Trans-Id: txa863fe8321ab4b44a31d886d1a9a7fb1
Date: Wed, 01 Aug 2012 14:17:30 GMT


The most important thing to note is that the X-Storage-Url points by default to an external IP. It means that every request sent has to go out to get than back to the cloud files. Unnecessary wasting of network bandwidth and additional latency and delay.

$ dig +short A

To work this around you can use a little modified X-Storage-Url value and append the snet string at the beginning to the server name.

$ dig +short A

$ dig +short A

Because the IP belongs to the Rackspace internal service network all the communication will be kept inside. From the cloud server point of view it will believe that it sent traffic to an internal host. No need to use a default gateway and complicated routing of deliver the traffic to the destination host.

A correct Cloud File API request that is utilizing the internal service network within Rackspace cloud infrastructure:

$ curl -X GET -D - -H "X-Auth-Token: mytoken"


No comments:

Post a Comment