This section of the documentation discusses how to authenticate against Swift using your Keystone credentials.
You first need to authenticate to keystone, which will look something like this:
curl -H 'content-type: application/json' \
-d '{"auth":{"tenantName":"'"$OS_TENANT_NAME"'",
"passwordCredentials": {"username":"'"$OS_USERNAME"'",
"password":"'"$OS_PASSWORD"'"}}}' \
http://localhost:5000/v2.0/tokens > keystone.json
This will return a big chunk of JSON; you want to extract the token
id. A good for this is jq, which you could use like this:
token=$(jq -r .access.token.id keystone.json )
You will also want to retrieve your swift endpoint from the service
catalog returned by keystone:
swift_url=$(jq '.access.serviceCatalog[] |
select(.name == "swift") | .endpoints[0].publicURL' keystone.json)
Which is going to set swift_url
to something like:
http://10.15.0.2:8080/v1/AUTH_c84fde6252d047c380e47b6c868d09e3
Now you can use this URL and your keystone token to create a
container:
curl -i -H "x-auth-token: $token" \
$swift_url/mycontainer -X PUT -H 'content-length: 0'
Which should respond:
HTTP/1.1 201 Created
Content-Length: 0
Content-Type: text/html; charset=UTF-8
Date: Mon, 14 Apr 2014 18:07:00 GMT
Additional examples are in the Object Storage API documentation.