Difference between revisions of "Rackspace API/Cloud Block Storage"
From Christoph's Personal Wiki
Line 56: | Line 56: | ||
* [http://www.rackspace.com/blog/boot-rackspace-cloud-servers-from-a-cloud-block-storage-volume/ Boot Rackspace Cloud Servers From A Cloud Block Storage Volume] | * [http://www.rackspace.com/blog/boot-rackspace-cloud-servers-from-a-cloud-block-storage-volume/ Boot Rackspace Cloud Servers From A Cloud Block Storage Volume] | ||
* [http://www.rackspace.com/knowledge_center/article/boot-a-server-from-a-cloud-block-storage-volume Boot a server from a Cloud Block Storage volume] | * [http://www.rackspace.com/knowledge_center/article/boot-a-server-from-a-cloud-block-storage-volume Boot a server from a Cloud Block Storage volume] | ||
+ | |||
+ | ==See also== | ||
+ | * [[Rackspace API]] | ||
[[Category:Rackspace]] | [[Category:Rackspace]] |
Revision as of 11:19, 10 December 2014
This article will show various examples and techniques for working with Rackspace's Cloud Cloud Block Storage (CBS) RESTful API.
HOWTO: boot from volume (BfV)
In this section, I will show you how to boot from a Cloud Block Storage (CBS) volume entirely using simple API calls (via cURL). This process is also known as "Boot from Volume" (BfV).
The examples in this article will do the following:
- Create a SATA CBS volume in DFW; and
- Boot a 1GB Performance-1 Cloud Server from that CBS volume in DFW;
- Step #0: Setup your environment variables:
$ ACCOUNT=012345 $ USERNAME=myraxusername $ API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx $ REGION=dfw $ CBS_ENDPOINT=https://${REGION}.blockstorage.api.rackspacecloud.com/v1/${ACCOUNT} $ SERVERS_ENDPOINT= https://${REGION}.servers.api.rackspacecloud.com/v2/${ACCOUNT} $ IMAGE_ID="68d5cc64-cb68-4275-9ede-9b062f7be070" # CentOS 6.5 $ FLAVOR="performance1-1" $ TOKEN=`curl -sXPOST https://identity.api.rackspacecloud.com/v2.0/tokens \ -d'{"auth":{"RAX-KSKEY:apiKeyCredentials":{"username":"'$USERNAME'","apiKey":"'$API_KEY'"}}}' \ -H"Content-type:application/json" | \ python -c 'import sys,json;data=json.loads(sys.stdin.read());print data["access"]["token"]["id"]'`
- Step #1: Create a CBS volume in DFW:
$ CBS_VOLUME_NAME="test-bfv-sata" $ CBS_VOLUME_TYPE="SATA" # or, "SSD" $ CBS_VOLUME_SIZE=75 # i.e., 75GB, the smallest possible volume $ curl -iXPOST -H "X-Auth-Token: $TOKEN" \ -H "Content-Type: application/json" -H "Accept: application/json" \ "$CBS_ENDPOINT/volumes" \ -d "{\"volume\": {\"display_name\": \"$CBS_VOLUME_NAME\", \"imageRef\": \"$IMAGE_ID\", \ \"availability_zone\": null, \"volume_type\": \"$CBS_VOLUME_TYPE\", \ \"display_description\": null, \"snapshot_id\": null, \"size\": $CBS_VOLUME_SIZE}}"
Watch the status of your CBS volume build until it goes from status "creating" to "active":
$ CBS_VOLUME_ID=aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee # From output of last command $ curl -i -H "X-Auth-Token: $TOKEN" \ -H "Content-Type: application/json" -H "Accept: application/json" \ "$CBS_ENDPOINT/volumes/$CBS_VOLUME_ID"
- Step #2: Boot a Cloud Server (in DFW) from the above CBS volume:
$ SERVER_ID=aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee # From output of last command $ curl -i -H "X-Auth-Token: $TOKEN" \ -H "Content-Type: application/json" -X POST -H "Accept: application/json" \ "$SERVERS_ENDPOINT/v2/$ACCOUNT/servers/$SERVER_ID"
That's it! You now have a Cloud Server that has been booted from a CBS volume.
Links
- Boot Rackspace Cloud Servers From A Cloud Block Storage Volume
- Boot a server from a Cloud Block Storage volume