1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
# S3 Bucket Management
The SeaweedFS Admin Interface now includes comprehensive S3 bucket management capabilities.
## Features
### Bucket Overview
- **Dashboard View**: List all S3 buckets with summary statistics
- **Bucket Statistics**: Total buckets, storage usage, object counts
- **Status Monitoring**: Real-time bucket status and health indicators
### Bucket Operations
- **Create Buckets**: Create new S3 buckets
- **Delete Buckets**: Remove buckets and all their contents (with confirmation)
- **View Details**: Browse bucket contents and object listings
- **Export Data**: Export bucket lists to CSV format
### Bucket Information
Each bucket displays:
- **Name**: Bucket identifier
- **Created Date**: When the bucket was created
- **Object Count**: Number of objects stored
- **Total Size**: Storage space used (formatted in KB/MB/GB/TB)
- **Region**: Configured AWS region
- **Status**: Current operational status
## Usage
### Accessing S3 Bucket Management
1. Start the admin server:
```bash
weed admin -port=23646 -masters=localhost:9333 -filer=localhost:8888
```
2. Open your browser to: `http://localhost:23646`
3. Click the "S3 Buckets" button in the dashboard toolbar
4. Or navigate directly to: `http://localhost:23646/s3/buckets`
### Creating a New Bucket
1. Click the "Create Bucket" button
2. Enter a valid bucket name (3-63 characters, lowercase letters, numbers, dots, hyphens)
3. Select a region (defaults to us-east-1)
4. Click "Create Bucket"
### Deleting a Bucket
1. Click the trash icon next to the bucket name
2. Confirm the deletion in the modal dialog
3. **Warning**: This permanently deletes the bucket and all its contents
### Viewing Bucket Details
1. Click on a bucket name to view detailed information
2. See all objects within the bucket
3. View object metadata (size, last modified, etc.)
## API Endpoints
The S3 bucket management feature exposes REST API endpoints:
### List Buckets
```
GET /api/s3/buckets
```
Returns JSON array of all buckets with metadata.
### Create Bucket
```
POST /api/s3/buckets
Content-Type: application/json
{
"name": "my-bucket-name",
"region": "us-east-1"
}
```
### Delete Bucket
```
DELETE /api/s3/buckets/{bucket-name}
```
Permanently deletes the bucket and all contents.
### Get Bucket Details
```
GET /api/s3/buckets/{bucket-name}
```
Returns detailed bucket information including object listings.
## Technical Implementation
### Backend Integration
- **Filer Integration**: Uses SeaweedFS filer for bucket storage at `/buckets/`
- **Streaming API**: Efficiently handles large bucket listings
- **Error Handling**: Comprehensive error reporting and recovery
### Frontend Features
- **Bootstrap UI**: Modern, responsive web interface
- **Real-time Updates**: Automatic refresh after operations
- **Form Validation**: Client-side bucket name validation
- **Modal Dialogs**: User-friendly create/delete workflows
### Security Considerations
- **Confirmation Dialogs**: Prevent accidental deletions
- **Input Validation**: Prevent invalid bucket names
- **Error Messages**: Clear feedback for failed operations
## Bucket Naming Rules
S3 bucket names must follow these rules:
- 3-63 characters in length
- Contain only lowercase letters, numbers, dots (.), and hyphens (-)
- Start and end with a lowercase letter or number
- Cannot contain spaces or special characters
- Cannot be formatted as an IP address
## Storage Structure
Buckets are stored in the SeaweedFS filer at:
```
/buckets/{bucket-name}/
```
Each bucket directory contains:
- Object files with their original names
- Nested directories for object key prefixes
- Metadata preserved from S3 operations
## Performance Notes
- **Lazy Loading**: Bucket sizes and object counts are calculated on-demand
- **Streaming**: Large bucket listings use streaming responses
- **Caching**: Cluster topology data is cached for performance
- **Pagination**: Large object lists are handled efficiently
## Troubleshooting
### Common Issues
1. **Bucket Creation Fails**
- Check bucket name follows S3 naming rules
- Ensure filer is accessible and running
- Verify sufficient storage space
2. **Bucket Deletion Fails**
- Ensure bucket exists and is accessible
- Check for permission issues
- Verify filer connectivity
3. **Bucket List Empty**
- Verify filer has `/buckets/` directory
- Check filer connectivity
- Ensure buckets were created through S3 API
### Debug Steps
1. Check admin server logs for error messages
2. Verify filer is running and accessible
3. Test filer connectivity: `curl http://localhost:8888/`
4. Check browser console for JavaScript errors
## Future Enhancements
- **Bucket Policies**: Manage access control policies
- **Lifecycle Rules**: Configure object lifecycle management
- **Versioning**: Enable/disable bucket versioning
- **Replication**: Configure cross-region replication
- **Metrics**: Detailed usage and performance metrics
- **Notifications**: Bucket event notifications
- **Search**: Search and filter bucket contents
|