





















Ceph RADOS Gateway (RGW) exposes an S3-compatible HTTP API. The AWS CLI works with Ceph RGW by pointing it at the RGW endpoint instead of AWS. This lets teams use familiar AWS tooling against their on-premises Ceph cluster.
kubectl -n rook-ceph exec -it deploy/rook-ceph-tools -- \
radosgw-admin user create \
--uid=awscli-user \
--display-name="AWS CLI User" \
--access-key=myaccesskey \
--secret-key=mysecretkeySet up a named profile pointing to Ceph RGW:
aws configure --profile ceph
# AWS Access Key ID: myaccesskey
# AWS Secret Access Key: mysecretkey
# Default region name: us-east-1
# Default output format: jsonCreate a bucket:
aws s3 mb s3://my-bucket \
--endpoint-url http://rook-ceph-rgw-my-store.rook-ceph:80 \
--profile cephUpload a file:
aws s3 cp /tmp/myfile.txt s3://my-bucket/myfile.txt \
--endpoint-url http://rook-ceph-rgw-my-store.rook-ceph:80 \
--profile cephList bucket contents:
aws s3 ls s3://my-bucket/ \
--endpoint-url http://rook-ceph-rgw-my-store.rook-ceph:80 \
--profile cephDownload a file:
aws s3 cp s3://my-bucket/myfile.txt /tmp/downloaded.txt \
--endpoint-url http://rook-ceph-rgw-my-store.rook-ceph:80 \
--profile cephaws s3 sync /var/backups/ s3://my-bucket/backups/ \
--endpoint-url http://rook-ceph-rgw-my-store.rook-ceph:80 \
--profile ceph \
--deletes3api SubcommandGet bucket ACL:
aws s3api get-bucket-acl \
--bucket my-bucket \
--endpoint-url http://rook-ceph-rgw-my-store.rook-ceph:80 \
--profile cephPut an object with metadata:
aws s3api put-object \
--bucket my-bucket \
--key config/app.yaml \
--body /tmp/app.yaml \
--metadata env=production,version=1.0 \
--endpoint-url http://rook-ceph-rgw-my-store.rook-ceph:80 \
--profile cephInstead of always passing --endpoint-url, export the built-in AWS_ENDPOINT_URL environment variable supported by AWS CLI v2:
export AWS_DEFAULT_REGION=us-east-1
export AWS_ACCESS_KEY_ID=myaccesskey
export AWS_SECRET_ACCESS_KEY=mysecretkey
export AWS_ENDPOINT_URL=http://rook-ceph-rgw-my-store.rook-ceph:80
aws s3 lsThe AWS CLI integrates seamlessly with Ceph RGW by using the --endpoint-url flag or an environment variable. All standard S3 operations including bucket management, file transfers, and metadata manipulation work against Ceph with no code changes required.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。