How to configure AWS S3 CLI for Ceph Object Gateway storage
Ceph Object Gateway is an object storage interface built on top of librados, which aims to provide applications with a RESTful gateway to the Ceph storage cluster. Ceph Object Gateway Daemon (Radosgw) Is an HTTP server used to interact with the Ceph storage cluster. It provides interfaces compatible with OpenStack Swift and Amazon S3, and has embedded user management.
Ceph Object Storage supports two interfaces.
- Compatible with S3: Object storage functionality is provided through an interface compatible with most subsets of the Amazon S3 RESTful API.
- Swift compatible: Object storage capabilities are provided through interfaces compatible with most subsets of the OpenStack Swift API.
In this guide, we will focus on configuring the Amazon S3 CLI for use with a Ceph object storage cluster. This will be helpful for automatic personal backups and for pushing your server data and configuration to Ceph Object Storage.
Step 1: Install the AWS CLI
We need to install the AWS CLI on the server or machine that will access the Ceph Object Gateway.
Follow the guide below to install the AWS CLI:
Install and use AWS CLI on Linux
Verify the installation:
$ aws --version
aws-cli/1.17.10 Python/2.7.5 Linux/3.10.0-1062.el7.x86_64 botocore/1.14.10
Step 2: Create an object store user for S3 access
Users should be created on the Ceph object storage backend. This will generate the S3 API credentials, and we will configure the AWS S3 CLI for use.
Run the command in one of the Ceph cluster nodes that can access the cluster for management.
sudo radosgw-admin user create --uid="computingforgeeks" --display-name="Computingforgeeks S3User"
where:
- Computer fan Is the name of the user to be created.
- Computing enthusiasts S3 users Is the user’s display name
This is a sample output of the command.
{
"user_id": "computingforgeeks",
"display_name": "Computingforgeeks S3User",
"email": "",
"suspended": 0,
"max_buckets": 1000,
"subusers": [],
"keys": [
{
"user": "computingforgeeks",
"access_key": "J18YW5BHJIVF69Y57IIT",
"secret_key": "JthVuEmluDqMuAZyc1oA0abaquc1U0WfemmzL5XS"
}
],
"swift_keys": [],
"caps": [],
"op_mask": "read, write, delete",
"default_placement": "",
"default_storage_class": "",
"placement_tags": [],
"bucket_quota": {
"enabled": false,
"check_on_raw": false,
"max_size": -1,
"max_size_kb": 0,
"max_objects": -1
},
"user_quota": {
"enabled": false,
"check_on_raw": false,
"max_size": -1,
"max_size_kb": 0,
"max_objects": -1
},
"temp_url_keys": [],
"type": "rgw",
"mfa_ids": []
}
Make a note of access_key and secret_key.
"user": "computingforgeeks"
"access_key": "J18YW5BHJIVF69Y57IIT"
"secret_key": "JthVuEmluDqMuAZyc1oA0abaquc1U0WfemmzL5XS"
Step 3: Accessing Ceph Object Storage Using the AWS CLI
Before you start using the AWS CLI tools to interact with AWS services, you need to configure them by running the aws configure command.
$ aws configure --profile=ceph
AWS Access Key ID [None]: J18YW5BHJIVF69Y57IIT
AWS Secret Access Key [None]: JthVuEmluDqMuAZyc1oA0abaquc1U0WfemmzL5XS
Default region name [None]:
Default output format [None]: json
Paste the access key and secret key you copied in the previous step. Credentials have been written to the file ~ / .Aws / voucher.
$ cat ~/.aws/credentials
[ceph]
aws_access_key_id = J18YW5BHJIVF69Y57IIT
aws_secret_access_key = JthVuEmluDqMuAZyc1oA0abaquc1U0WfemmzL5XS
The configuration file is located in ~ / .aws / config.
$ cat ~/.aws/config
[profile ceph]
output = json
You need to configure the IP address or equivalent DNS name of one of the Rados Gateway nodes. Use the following command to get the list of rgw servers:
$ sudo ceph -s | grep rgw
rgw: 3 daemons active (ceph-rgw-01, ceph-rgw-02, ceph-rgw-03)
In my setup, I have three rgw servers. I will use one of them- ceph-rgw-01, Whose URL is http://172.21.148.53
$ aws --profile=ceph --endpoint=http://172.21.148.53 s3 mb s3://test
The command will create a file named test. You can confirm the creation with the radosgw-admin command.
$ sudo radosgw-admin bucket list
[
"jkmutai-bucket",
"test"
]
You can list buckets created using the following command:
$ aws --profile=ceph --endpoint=http://172.21.148.53 s3 ls
2020-02-13 15:17:13 test
Copy the test file into the bucket:
$ aws --profile=ceph --endpoint=http://172.21.148.53 s3 cp release.asc s3://test/
upload: ./release.asc to s3://test/release.asc
Confirm that the file has been uploaded.
$ aws --profile=ceph --endpoint=http://172.21.148.53 s3 ls s3://test/
2020-02-13 16:04:17 1645 release.asc
You can do this from the “Confirm” under “Ceph Dashboard” Object Gateway> Bucket section.
reference: Ceph Object Gateway
Related guidelines:
Ceph vs GlusterFS vs MooseFS vs HDFS vs DRBD
How to install Ceph Storage Cluster on Ubuntu 18.04 LTS
Monitoring Ceph clusters with Prometheus and Grafana