Files
seaweedfs/weed/admin/S3_BUCKETS.md
T
Chris LuandCopilot 1defee3d68 Add admin component (#6928)
* init version

* relocate

* add s3 bucket link

* refactor handlers into weed/admin folder

* fix login logout

* adding favicon

* remove fall back to http get topology

* grpc dial option, disk total capacity

* show filer count

* fix each volume disk usage

* add filers to dashboard

* adding hosts, volumes, collections

* refactor code and menu

* remove "refresh" button

* fix data for collections

* rename cluster hosts into volume servers

* add masters, filers

* reorder

* adding file browser

* create folder and upload files

* add filer version, created at time

* remove mock data

* remove fields

* fix submenu item highlighting

* fix bucket creation

* purge files

* delete multiple

* fix bucket creation

* remove region from buckets

* add object store with buckets and users

* rendering permission

* refactor

* get bucket objects and size

* link to file browser

* add file size and count for collections page

* paginate the volumes

* fix possible SSRF

https://github.com/seaweedfs/seaweedfs/pull/6928/checks?check_run_id=45108469801

* Update weed/command/admin.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update weed/command/admin.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix build

* import

* remove filer CLI option

* remove filer option

* remove CLI options

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-01 01:28:09 -07:00

174 lines
4.9 KiB
Markdown

# 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