Getting started with trystack.org (OpenStack sandbox)
Here are several simple steps to get you started with http://trystack.org, a sandbox for http://openstack.org
OpenStacks mission is to produce the ubiquitous Open Source Cloud Computing platform that will meet the needs of public and private clouds regardless of size, by being simple to implement and massively scalable.
I have replaced all valid IDs with ***
Register
Go to http://eepurl.com/nGEzj and follow the registration steps
Get approved
The approval process appears to be manual so it can take a couple of days. Once you receive a confirmation email log into http://arm.trystack.org/nova/
Successful login means you can browse OpenStack WebUI as well as execute API calls.
API | Get auth token
The first step in using OpenStack APIs is to get a token. The first token we get is kind of temporary token since we don't know our tenantId yet.
curl -k -X 'POST' -v http://arm.trystack.org:5000/v2.0/tokens -d '{"auth":{"passwordCredentials":{"username": "user***", "password":"pass***"}, "tenantId":""}}' -H 'Content-type: application/json'
Note an empty tenantId
{
"access": {
"token": {
"expires": "2012-10-31T20:48:27Z",
"id": "token***"
},
"serviceCatalog": {},
"user": {
"username": "user***",
"roles_links": [],
"id": "***",
"roles": [],
"name": "user***"
}
}
}
API | Use auth token to retrieve tenantId
curl -H "X-Auth-Token:token***" http://arm.trystack.org:5000/v2.0/tenants
{
"tenants_links": [],
"tenants": [
{
"enabled": "true",
"description": "user***",
"name": "user***",
"id": "tenant***"
}
]
}
API | Get a real token
Now we can get a real token since we know our tenantId
curl -k -X 'POST' -v http://arm.trystack.org:5000/v2.0/tokens -d '{"auth":{"passwordCredentials":{"username": "user***", "password":"pass***"}, "tenantId":"tenant***"}}' -H 'Content-type: application/json'
The resulting JSON will contain a list of endpoints, for example:
{
"endpoints": [
{
"adminURL": "http://10.225.0.8:8774/v2/tenant***",
"region": "Calxeda-AUS1",
"internalURL": "http://10.225.0.8:8774/v2/tenant***",
"publicURL": "http://208.123.85.197:8774/v2/tenant***"
}
],
"endpoints_links": [],
"type": "compute",
"name": "nova"
}
as well as a new valid token:
{
"access": {
"token": {
"expires": "2012-10-31T17: 13: 12Z",
"id": "new_token***",
"tenant": {
"enabled": true,
"id": "tenant***",
"name": "user***",
"description": "user***"
}
}
}
API | Querying servers
Now we have 2 important parameters to make a server status query:
A valid auth token
An endpoint URL for Compute API
curl -v -H "X-Auth-Token:new_token***" http://208.123.85.197:8774/v2/tenant***/servers
Result is a server metadata. Note that trystack.org will provision a default Ubuntu server for you when you register.
{
"servers": [
{
"id": "server***",
"links": [
{
"href": "http://208.123.85.197:8774/v2/tenant***/servers/server***",
"rel": "self"
},
{
"href": "http://208.123.85.197:8774/tenant***/servers/server***",
"rel": "bookmark"
}
],
"name": "The best server ever"
}
]
}
Written by Vladimir Reshetnikov
Related protips
1 Response
Thanks a lot, useful indeed.
In case someone is interested just traslated in python unsing requests
http://www.storchi.org/pages/authenticate_and_start.html
Loriano