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"  https://lon.auth.api.rackspacecloud.com/v1.0
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
X-Storage-Url: https://storage101.lon3.clouddrive.com/v1/MossoCloudFS_f3ae48bb-983f-49e1-b656-0c58730fed1b
Cache-Control: s-maxage=63832
Content-Type: text/xml
Date: Wed, 01 Aug 2012 14:04:51 GMT
X-Auth-Token: 22222222
X-Server-Management-Url: https://lon.servers.api.rackspacecloud.com/v1.0/10020713
X-Storage-Token: 111111111111
Connection: Keep-Alive
X-CDN-Management-Url: https://cdn3.clouddrive.com/v1/MossoCloudFS_f3ae48bb-983f-49e1-b656-0c58730fed1b
Content-Length: 0

# get listing 
$ curl -X GET -D - -H "X-Auth-Token: myusr" https://storage101.lon3.clouddrive.com/v1/MossoCloudFS_f3ae48bb-983f-49e1-b656-0c58730fed1b
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

Test1
Test2

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 storage101.lon3.clouddrive.com
94.236.56.96

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 storage101.lon3.clouddrive.com
94.236.56.96

$ dig +short A snet-storage101.lon3.clouddrive.com
10.191.209.30

Because the IP 10.191.209.30 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" https://snet-storage101.lon3.clouddrive.com/v1/MossoCloudFS_f3ae48bb-983f-49e1-b656-0c58730fed1b

References
  1. http://docs.rackspace.com/files/api/v1/cf-devguide/content/Authentication-d1e639.html
  2. http://www.rackspace.com/cloud/public/files/api/
  3. http://www.rackspace.com/knowledge_center/getting-started/cloud-files
  4. http://blog.chmouel.com/2009/10/20/accessing-to-rackspace-cloud-files-via-servicenet-update/
  5. http://loose-bits.com/2010/10/rackspace-cloud-files-and-servicenet.html
  6. http://docs.rackspace.com/files/api/v1/cf-devguide/content/Service-Access-Endpoints-d1e003.html

No comments:

Post a Comment