Files
floci/docs/services/s3.md
T
sf-jin-ku 2efb483390 feat(s3): preserve explicit object SSE headers (#515)
* feat(s3): preserve explicit object SSE headers
* refactor(s3): validate and encapsulate SSE write options
* fix(s3): make notification filter parsing deterministic
* fix(ses): harden identity deletion lookups
* fix(ses): reject padded identities literally
* fix(secretsmanager): keep a single previous stage
2026-04-19 23:36:36 -05:00

151 lines
5.3 KiB
Markdown

# S3
**Protocol:** REST XML
**Endpoint:** `http://localhost:4566/{bucket}/{key}`
## Supported Operations
| Category | Operations |
|---|---|
| **Buckets** | ListBuckets, CreateBucket, HeadBucket, DeleteBucket, GetBucketLocation |
| **Objects** | PutObject, GetObject, GetObjectAttributes, HeadObject, DeleteObject, DeleteObjects, CopyObject |
| **Listing** | ListObjects, ListObjectsV2, ListObjectVersions |
| **Multipart** | CreateMultipartUpload, UploadPart, CompleteMultipartUpload, AbortMultipartUpload, ListMultipartUploads |
| **Versioning** | PutBucketVersioning, GetBucketVersioning |
| **Tagging** | PutBucketTagging, GetBucketTagging, PutObjectTagging, GetObjectTagging, DeleteObjectTagging |
| **Policy** | PutBucketPolicy, GetBucketPolicy, DeleteBucketPolicy |
| **CORS** | PutBucketCors, GetBucketCors, DeleteBucketCors |
| **Lifecycle** | PutBucketLifecycle, GetBucketLifecycle, DeleteBucketLifecycle |
| **ACL** | PutBucketAcl, GetBucketAcl, PutObjectAcl, GetObjectAcl |
| **Encryption** | PutBucketEncryption, GetBucketEncryption, DeleteBucketEncryption |
| **Notifications** | PutBucketNotification, GetBucketNotification |
| **Object Lock** | PutObjectLockConfiguration, GetObjectLockConfiguration, PutObjectRetention, GetObjectRetention, PutObjectLegalHold, GetObjectLegalHold |
| **Pre-signed URLs** | Generates and validates pre-signed GET/PUT URLs |
| **S3 Select** | SelectObjectContent |
| **Public Access Block** | PutPublicAccessBlock, GetPublicAccessBlock, DeletePublicAccessBlock |
**RestoreObject** is accepted but stubbed: Floci validates the request and returns `202 Accepted`, but no restore state machine runs.
## Not Implemented
These AWS S3 features have no handler in Floci. Calls will return an error (typically `404` or `NoSuchBucket`-style):
- Replication (`PutBucketReplication`, `GetBucketReplication`, `DeleteBucketReplication`)
- Website hosting (`PutBucketWebsite`, `GetBucketWebsite`, `DeleteBucketWebsite`)
- Access logging (`PutBucketLogging`, `GetBucketLogging`)
- Request payment (`PutBucketRequestPayment`, `GetBucketRequestPayment`)
- Intelligent-Tiering configurations
- Inventory configurations
- Metrics and Analytics configurations
## Configuration
```yaml
floci:
services:
s3:
enabled: true
default-presign-expiry-seconds: 3600
auth:
presign-secret: local-emulator-secret
```
## Examples
```bash
export AWS_ENDPOINT_URL=http://localhost:4566
# Create bucket
aws s3 mb s3://my-bucket --endpoint-url $AWS_ENDPOINT_URL
# Upload a file
aws s3 cp ./report.pdf s3://my-bucket/reports/report.pdf --endpoint-url $AWS_ENDPOINT_URL
# Upload inline content
echo '{"hello":"world"}' | aws s3 cp - s3://my-bucket/data.json --endpoint-url $AWS_ENDPOINT_URL
# Download
aws s3 cp s3://my-bucket/data.json ./data.json --endpoint-url $AWS_ENDPOINT_URL
# Inspect object attributes without downloading the body
aws s3api get-object-attributes \
--bucket my-bucket \
--key data.json \
--object-attributes ETag ObjectSize StorageClass \
--endpoint-url $AWS_ENDPOINT_URL
# List
aws s3 ls s3://my-bucket --endpoint-url $AWS_ENDPOINT_URL
# Delete
aws s3 rm s3://my-bucket/data.json --endpoint-url $AWS_ENDPOINT_URL
# Enable versioning
aws s3api put-bucket-versioning \
--bucket my-bucket \
--versioning-configuration Status=Enabled \
--endpoint-url $AWS_ENDPOINT_URL
# Generate a pre-signed URL (valid for 1 hour)
aws s3 presign s3://my-bucket/report.pdf \
--expires-in 3600 \
--endpoint-url $AWS_ENDPOINT_URL
```
## Path-Style URLs
Floci uses path-style URLs:
```
http://localhost:4566/my-bucket/my-key
```
When using the AWS SDK, enable path-style mode:
=== "Java"
```java
S3Client s3 = S3Client.builder()
.endpointOverride(URI.create("http://localhost:4566"))
.serviceConfiguration(S3Configuration.builder()
.pathStyleAccessEnabled(true)
.build())
.build();
```
=== "Node.js"
```javascript
const s3 = new S3Client({
endpoint: "http://localhost:4566",
forcePathStyle: true,
});
```
=== "Python"
```python
s3 = boto3.client("s3",
endpoint_url="http://localhost:4566",
config=Config(s3={"addressing_style": "path"}))
```
## Object Attribute Notes
Floci now persists and returns the following object attribute state on S3 object APIs:
- user metadata from `x-amz-meta-*`
- storage class from `x-amz-storage-class`
- checksum metadata for object reads and `GetObjectAttributes`
- multipart part manifests for `GetObjectAttributes(ObjectParts)`
- canned object ACLs from `x-amz-acl` on `PutObject`, `CopyObject`, and multipart initiation
- explicit object SSE headers from `x-amz-server-side-encryption` on `PutObject`, `CopyObject`, and multipart initiation, replayed on `GetObject` and `HeadObject`
Current limitations:
- checksum responses focus on SHA-1 and SHA-256
- copy-based metadata updates support `x-amz-metadata-directive: REPLACE` for user metadata and content type, but do not yet cover every AWS copy header
- explicit ACL grant headers such as `x-amz-grant-read` and `x-amz-grant-full-control` are not modeled yet
- cross-account canned ACL variants collapse to the emulator's single synthetic owner where Floci does not model a distinct second principal
- `aws-exec-read` is accepted for compatibility, but Floci does not yet model a distinct EC2 bundle-reader grantee in `GetObjectAcl`