Rackspace Cloud Server Deletion
One of client is using rackspace cloud for their servers. Went through some upgrade this weekend and found out that rackspace doesn’t allow its customer to delete a server from its web interface. When click on delete, it will prompt you with following:
There must be some sort of reason behind this, but logic, sound, business reason not allowing its customer to delete a server from the web interface. But as a user, it’s just a terrible user experience.
Turns out, if you’re a REAL power user, you can use rackspace’s API to delete a server. Here’s how:
Login to web, get your username and API key under “My Profile and Settings” then run following curl command with username and apiKey set to your own settings.
curl https://identity.api.rackspacecloud.com/v2.0/tokens -X POST -d ‘{“auth”:{“RAX-KSKEY:apiKeyCredentials”:{“username”:”yourUsername”,”apiKey”:”yourAPIKey"}}}’ -H “Content-type: application/json” | python -m json.tool
from the output, find server api url. That’s right, there is a specific server API endpoint instead of one central api endpoint. It will contain your tenant ID at the end of URL, in this case 123443 is the tenant ID.
export API_ENDPOINT=”https://iad.servers.api.rackspacecloud.com/v2/123443"
Find token id, that’s the token to use to make api call
export AUTH_TOKEN=”AAAfdNKdRn15cnhasdflas3wunlKSJASfWXN2YUZ2xffZPdljq6Q-V5q6jT0asdfas7kG2KSKtAF493jasdfas2asdafUyCNZsspeqa91cTh3Dq9lKOW9jH5p_mhrexzvJthsdF6k6eu5IHPoqYRAXzp0kqgcoJr4BG37SpVRinY_4"
once you have those two variables, again, use your UI to find server id to delete and run following curl:
curl -i $API_ENDPOINT/servers/0ajsdd0e-2805–4466-a38e-2azzdwda9bd1b -X DELETE -H “X-Auth-Token: $AUTH_TOKEN”
If it returns HTTP 204, then it went through.