Currently in Rackspace-Cloud when you are shutting-down your Cloud Servers you are still paying for it.
The reason is that when the Cloud Server is shut-down your CloudServer is still sitting on the hyper-visor and still use resources on the Cloud and then get you billed for it.
There is a way to get around it by having the CloudServer stored as an image into CloudFiles.
The caveat with this solution is that every-time you are creating a server out of the stored image you are getting a new IP and in certain cases you would need to make a change in your application with the new IP.
If you only use domain names instead of IP in your application you are not dependent of the IP change, to update the domain with the new IP after creating the VM you can either :
– Have a dynamic DNS or ‘Cloud DNS’ updated just after you created your server out of the image.
– Have a script going into your server and update the IP directly in /etc/hosts.
In programming words this is the steps you would do. I am using the python-nova binding which allow you to connect to RackSpace Cloud.
At first I am going to create an object which we are going to authenticate
cx = novaclient.OpenStack(USERNAME,
or for the UK :
cx = novaclient.OpenStack("USERNAME",
cx is going to be the object from where we can do things on it. Let’s first find the server server that we want, assuming your server is called test you would get the server like this :
server = cx.servers.find(name='test')
The variable ‘server’ contain our server ‘object’ and we can get its ID out of it :
server_id = server.id
We got the function cx.images.create to create an image from a server which accept as first argument the image name and the second the server id we just got. this would start the creation of the image :
The server has started to get backed-up into your Cloud Files account, you can see it directly into the “My Server Images” tab of Hosting => Cloud Servers section :
You can now delete the server since it’s ‘backuped’ into cloud files ;
At this time you are not billed for your Cloud Servers anymore and only for the storage usage in Cloud Files.
When you want to restore the image as a server, you would first get the id of your image :
image = cx.images.find(name='backup-test')
image_id = image.id
and create the server out of this image :
The flavor argument is the type of image you want, 1 the minimal 256M flavor. The full list is :
In : for x in cx.flavors.list():
....: print x.id, '-', x.name
1 - 256 server
2 - 512 server
3 - 1GB server
4 - 2GB server
5 - 4GB server
6 - 8GB server
7 - 15.5GB server
When the server has created it should be exactly the same as what you have before created in image. You can now run a script using SSH with SSH keys to log into servers and do adjustment with the new IP.