惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Tailwind CSS Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
雷峰网
雷峰网
量子位
有赞技术团队
有赞技术团队
阮一峰的网络日志
阮一峰的网络日志
The Cloudflare Blog
博客园 - Franky
罗磊的独立博客
宝玉的分享
宝玉的分享
博客园_首页
腾讯CDC
The GitHub Blog
The GitHub Blog
D
DataBreaches.Net
IT之家
IT之家
D
Docker
Microsoft Security Blog
Microsoft Security Blog
博客园 - 司徒正美
V
V2EX
月光博客
月光博客
N
Netflix TechBlog - Medium
爱范儿
爱范儿
I
InfoQ
P
Proofpoint News Feed

OneUptime Blog

How to Monitor Azure App Services (PaaS) with OpenTelemetry Grafana Stack vs OneUptime: DIY Observability or Unified Platform? Your AI Workloads Are About to Blow Up Your Observability Bill The Great Observability Consolidation Is Here How to Write Custom Object Classes for Ceph How to Write Custom Ceph Manager Modules How to Write a ceph.conf Configuration File How to Use Rook-Ceph with OpenShift How to Use Rook-Ceph with Longhorn for Comparison How to Configure Volume Snapshot Class for RBD in Rook How to Configure VolumeReplicationClass Scheduling Intervals in Rook How to Set Up Volume Replication with Rook-Ceph How to Create Volume Group Snapshots with Rook CSI How to Visualize Ceph Network Performance in Grafana How to Enable Virtual Host-Style Bucket Access in Rook How to View Runtime Configuration via Admin Socket How to View Quota Settings and Update Stats in Ceph RGW How to View PG Scaling Recommendations with autoscale-status How to View PG Distribution via Admin Socket How to View Performance Metrics in the Ceph Dashboard How to View OSD Performance Counters in Ceph How to View Connection Status via Admin Socket How to View Ceph Cluster Summary Dashboard via CLI How to Version Control Rook-Ceph Configuration How to Version Control Ceph Infrastructure with Terraform How to Verify Kubernetes Node Requirements for Rook-Ceph Deployment How to Verify Health Before and After Rook Upgrades How to Verify Data Integrity with Deep Scrubbing How to Verify Complete Rook-Ceph Cleanup How to Verify Backup Integrity from Ceph Snapshots
How to Use the Swift API with Ceph RGW
Nawaz Dhandala · 2026-03-31 · via OneUptime Blog

Overview

Ceph RGW implements the OpenStack Swift API alongside the S3 API from the same RGW service, typically using a different URL prefix for Swift requests. This allows Swift-native clients, including OpenStack services and Python swiftclient, to store and retrieve objects from Ceph. Swift uses a different authentication model and terminology compared to S3 (containers instead of buckets, accounts instead of users).

Swift Terminology vs. S3

SwiftS3 Equivalent
AccountUser/Tenant
ContainerBucket
ObjectObject
SubuserNo direct S3 equivalent

Creating a Swift-Compatible Subuser

Swift authentication requires a subuser in the format uid:subuser:

# Create a user and subuser for Swift
radosgw-admin user create \
  --uid=swiftuser \
  --display-name="Swift User"

# Create the subuser
radosgw-admin subuser create \
  --uid=swiftuser \
  --subuser=swiftuser:main \
  --access=full

# Generate a Swift secret key
radosgw-admin key create \
  --uid=swiftuser \
  --subuser=swiftuser:main \
  --key-type=swift \
  --gen-secret

# Retrieve the Swift secret
radosgw-admin user info --uid=swiftuser | jq '.swift_keys'

Authenticating with Swift v1

With Ceph's default rgw_swift_auth_entry, Swift v1 auth uses a simple HTTP header exchange:

# Get the auth token and storage URL
curl -i http://rgw-host:80/auth \
  -H "X-Auth-User: swiftuser:main" \
  -H "X-Auth-Key: YOUR_SWIFT_SECRET"

# Response headers include:
# X-Auth-Token: TOKEN_VALUE
# X-Storage-Url: returned by RGW, typically http://rgw-host:80/swift/v1
# or http://rgw-host:80/swift/v1/AUTH_<account> depending on configuration

Using swiftclient CLI

# Install swiftclient
pip install python-swiftclient

# Set environment variables
export ST_AUTH=http://rgw-host:80/auth
export ST_AUTH_VERSION=1.0
export ST_USER=swiftuser:main
export ST_KEY=YOUR_SWIFT_SECRET

# List containers (buckets)
swift list

# Create a container
swift post mycontainer

# Upload an object
swift upload mycontainer localfile.txt

# Download an object
swift download mycontainer localfile.txt --output download.txt

# List objects in a container
swift list mycontainer

Using Python swiftclient Library

import swiftclient

conn = swiftclient.Connection(
    authurl='http://rgw-host:80/auth',
    user='swiftuser:main',
    key='YOUR_SWIFT_SECRET',
    auth_version='1.0'
)

# Create a container
conn.put_container('mycontainer')

# Upload an object
with open('file.txt', 'rb') as f:
    conn.put_object('mycontainer', 'file.txt', f)

# Download an object
headers, obj = conn.get_object('mycontainer', 'file.txt')
with open('downloaded.txt', 'wb') as f:
    f.write(obj)

# List objects
headers, objects = conn.get_container('mycontainer')
for obj in objects:
    print(obj['name'], obj['bytes'])

Object Metadata and Bulk Operations

# Add metadata to an object
swift post mycontainer file.txt \
  --header "X-Object-Meta-Author: Alice"

# Bulk delete objects
swift delete mycontainer file1.txt file2.txt

# Copy an object
swift copy --destination /destcontainer/newfile.txt mycontainer file.txt

Summary

Ceph RGW's Swift API compatibility allows Swift-native clients to use Ceph for object storage operations. Create Swift subusers via radosgw-admin, authenticate using Swift v1 auth, and use standard swiftclient commands or the Python library for container and object operations. Swift and S3 clients can coexist on the same Ceph cluster with independent credentials.