How to download the saved images in the Rackspace cloud server?

I wonder if someone know how could I download the saved server image in a Rackspace cloud server. I have been searching and nothing found even in the Rackspace knowledge base. I know it is stored in the file system, but where exactly is it?

If I download my images from the server, I can save disk space, and if one day (I hope never) I really need to restore from the image, I can easily upload the image back. But this information in Rackspace is so obscure. I just do not want to open an ticket/support to ask only this question, and I hope someone else has had the same problem and help me out.

I'm using centOS 6.4, any help I will be very thankful. I mean if you guys know where in the file system the image is stored, it's all I need to know.

Cheers! ;)


There isn't a way to download the server images currently.

What you can do right now is create an image of your server (which gets stored in the Saved Images section), then restore the image from there. This isn't what you're asking for, but that's the limit right now.

The image storing is part of OpenStack projects called Glance and OpenStack Swift (effectively they're stored to CloudFiles). While this feature exists, it's not currently exposed/implemented by Rackspace.


Step 1, make a container named "export" under Storage > Files inside the rackspace cloud control panel.

Step 2, customize this script and run it on any unix machine OR read the docs below it to see other methods.

#!/bin/bash
sudo apt-get install python-dev gcc python-pip
sudo pip install swiftly eventlet


SWIFTLY_AUTH_URL=https://identity.api.rackspacecloud.com/v2.0

# your Rackspace cloud username
# Username used to login to control panel
SWIFTLY_AUTH_USER=myuser      
CUSTOMERID=123456798

# your Rackspace cloud API key
# Find the APIKey in the 'account settings' part of the menu of the control panel
APIKEY='fake0u23jiofds9032ijofds09823rijpo'
SWIFTLY_AUTH_KEY=$APIKEY       
# 3 char region code for where your exported image is located (e.g., ORD)
SWIFTLY_REGION=DFW        
REGION_EXPORTING_FROM=dfw
# what you want the downloaded image file to be named
LOCALFILENAME=MyDownloadedServer    
 # the container in Cloud Files containing your exported image
CONTAINER=export

# Find the image ID you'd like to make available on cloud files
# set the image id below of the image you want to copy to cloud files, see in control panel
IMAGEID=fake581e-c14561-3c46-45687-e045646675
IMAGEFILENAME=$IMAGEID    # the name of your exported image in Cloud Files

# This section simply retrieves the TOKEN
TOKEN=$(curl -s https://identity.api.rackspacecloud.com/v2.0/tokens -X POST -d '{"auth":{"RAX-KSKEY:apiKeyCredentials":{"username":"'${SWIFTLY_AUTH_USER}'","apiKey":"'${APIKEY}'"}}}' -H "Content-type: application/json" | python -c 'import json, sys; data = json.loads(sys.stdin.read()); print data["access"]["token"]["id"]')

# IMPORTANT: change receiving_swift_container to whatever $CONTAINER is
# This section requests the Glance API to copy the cloud server image uuid to a cloud files container called export
curl "https://$REGION_EXPORTING_FROM.images.api.rackspacecloud.com/v2/$CUSTOMERID/tasks" -X POST -H "X-Auth-Token: $TOKEN" -H "Content-Type: application/json" -d '{"type": "export", "input": {"image_uuid": "'"$IMAGEID"'", "receiving_swift_container": "export"}}'

# The above command simply set a pending command. Go play a game while it finishes.
sleep 4h;

swiftly   --auth-url=$SWIFTLY_AUTH_URL  --auth-user=$SWIFTLY_AUTH_USER   --auth-key=$SWIFTLY_AUTH_KEY   --region=$SWIFTLY_REGION   --verbose   get    --output=${LOCALFILENAME}  ${CONTAINER}/${IMAGEFILENAME}

For more info;

1) Exporting the image to Cloud Files

You can export the image from Rackspace to your Cloud Files containers using the API. The article below can guide you through that process.

Exporting Cloud Server Images from the Rackspace Cloud

https://community.rackspace.com/products/f/25/t/7089?_ga=1.161905660.1332227198.1487618904


There is also a tool you can use called ‘Pitchfork’. Once you log into Pitchfork using your username and API key, you would navigate to the ‘Images’ section and choose ‘Export’. Once you run that API call, some time will pass before you see the image in one or multiple Cloud Files containers.

Pitchfork: https://pitchfork.rax.io/

https://community.rackspace.com/products/f/25/t/6432?_ga=1.161936636.1332227198.1487618904

2) Downloading image from Cloud Files

You can use Swiftly to download the image from Cloud Files. An object in Cloud files cannot be greater than 5GB. If your image is greater than this, it will be divided into multiple Cloud files objects, which can be downloaded and reassembled locally using Swiftly.

https://support.rackspace.com/how-to/use-swiftly-to-download-an-exported-image/


Rackspace currently doesn't expose a feature to download your server images, but that doesn't mean you can never get one.

This is completely undocumented by Rackspace, but they have done it on request for other customers in the past:

If your server is unresponsive and you enter in a support ticket, Rackspace can usually take an emergency snapshot of your server and provide you with download links for it. For Linux instances, Rackspace will provide a gzipped raw image of your disk/partition; for Windows instances you will receive a VHD.