Command-line interface for the Rackspace Cloud.
rack
provides a consistent interface for interacting with the Rackspace Cloud. For example, creating a new server:
$ rack servers instance create \
--name my-server \
--image-id 5ed162cc-b4eb-4371-b24a-a0ae73376c73 \
--flavor-id general1-1 \
--keypair my-laptop
ID 9818861f-2f14-437f-89b0-a36dfa1831b7
AdminPass 4vLb2PiqUGdP
Make sure you have Go installed and the GOPATH
environment variable set.
go get github.com/rackspace/rack
cd $GOPATH/src/github.com/rackspace/rack
./script/build
rack
has a number of ways of getting credentials configured. The easiest way is to use rack configure
to setup a profile:
$ rack configure
This interactive session will walk you through creating
a profile in your configuration file. You may fill in all or none of the
values.
Rackspace Username: iamacat
Rackspace API key: secrets
Rackspace Region: IAD
Profile Name (leave blank to create a default profile):
This will create a configuration file at ~/.rack/config
which will store your credentials. When using the default profile, you don't need to specify the profile:
rack servers instance list
However, if you've named a profile, you can use the --profile
flag to specify it explicitly:
rack servers instance list --profile staging
In addition to using the config file, you can also use environment variables. The following environment variables are supported:
RS_REGION_NAME
(DFW, IAD, ORD, LON, SYD, HKG)
RS_USERNAME
(Your Rackspace username)
RS_API_KEY
(Your Rackspace API key)
Lastly, you can also set your authentication credentials as flags:
$ rack servers instance list --username user1 --api-key 123456789 --region DFW
rack
will first look for credentials as flags. Secondly, rack
will use a named profile, or default
if there is a default profile. Lastly, rack
will look for environment variables.
At any time, you can run rack init
which will create the auto-completion file in ~/.rack/bash_autocomplete
and add it to ~/.bash_profile
. You'll need to restart your terminal session to enable auto-completion.
For command completion on Windows, please see the command completion section on the configuration page of our documentation.