Chapter 4. Using The Gateway
To use the REST interfaces, first create an initial Ceph Object Gateway user for the S3 interface. Then, create a subuser for the Swift interface. You then need to verify if the created users are able to access the gateway.
4.1. Create a radosgw user for S3 access Copy linkLink copied to clipboard!
A radosgw
user needs to be created and granted access. The command man radosgw-admin
will provide information on additional command options.
To create the user, execute the following on the gateway host
:
sudo radosgw-admin user create --uid="testuser" --display-name="First User"
sudo radosgw-admin user create --uid="testuser" --display-name="First User"
The output of the command will be something like the following:
The values of keys->access_key
and keys->secret_key
are needed for access validation.
4.2. Create a Swift user Copy linkLink copied to clipboard!
A Swift subuser needs to be created if this kind of access is needed. Creating a Swift user is a two step process. The first step is to create the user. The second is to create the secret key.
Execute the following steps on the gateway host
:
Create the Swift user:
sudo radosgw-admin subuser create --uid=testuser --subuser=testuser:swift --access=full
sudo radosgw-admin subuser create --uid=testuser --subuser=testuser:swift --access=full
The output will be something like the following:
Create the secret key:
sudo radosgw-admin key create --subuser=testuser:swift --key-type=swift --gen-secret
sudo radosgw-admin key create --subuser=testuser:swift --key-type=swift --gen-secret
The output will be something like the following:
4.3. Access Verification Copy linkLink copied to clipboard!
4.3.1. Test S3 access Copy linkLink copied to clipboard!
You need to write and run a Python test script for verifying S3 access. The S3 access test script will connect to the radosgw
, create a new bucket and list all buckets. The values for aws_access_key_id
and aws_secret_access_key
are taken from the values of access_key
and secret_key
returned by the radosgw_admin
command.
Execute the following steps:
You will need to install the
python-boto
package.sudo apt-get install python-boto
sudo apt-get install python-boto
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the Python script:
vi s3test.py
vi s3test.py
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Add the following contents to the file:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Replace
{FQDN}
with the full hostname i.e, the fully qualified domain name of the host where you have configured the gateway service i.e, thegateway host
.Run the script:
python s3test.py
python s3test.py
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
The output will be something like the following:
my-new-bucket 2015-02-16T17:09:10.000Z
my-new-bucket 2015-02-16T17:09:10.000Z
4.3.2. Test swift access Copy linkLink copied to clipboard!
Swift access can be verified via the swift
command line client. The command man swift
will provide more information on available command line options.
To install swift
client, execute the following:
sudo apt-get install python-setuptools sudo easy_install pip sudo pip install --upgrade setuptools sudo pip install --upgrade python-swiftclient
sudo apt-get install python-setuptools
sudo easy_install pip
sudo pip install --upgrade setuptools
sudo pip install --upgrade python-swiftclient
To test swift access, execute the following:
swift -A http://{IP ADDRESS}/auth/1.0 -U testuser:swift -K '{swift_secret_key}' list
swift -A http://{IP ADDRESS}/auth/1.0 -U testuser:swift -K '{swift_secret_key}' list
Replace {IP ADDRESS}
with the public IP address of the gateway server and {swift_secret_key}
with its value from the output of radosgw-admin key create
command executed for the swift
user.
For example:
swift -A http://10.19.143.116/auth/1.0 -U testuser:swift -K '244+fz2gSqoHwR3lYtSbIyomyPHf3i7rgSJrF/IA' list
swift -A http://10.19.143.116/auth/1.0 -U testuser:swift -K '244+fz2gSqoHwR3lYtSbIyomyPHf3i7rgSJrF/IA' list
The output should be:
my-new-bucket
my-new-bucket