Files
floci/docs/services/s3tables.md
T
Kenshin Okinaka 7a57347fbb feat(s3tables): add TagResource, UntagResource and ListTagsForResource (#9724)
S3 Tables accepted tags only at CreateTableBucket and CreateTable, so a
client could not read them back or change them.

The three operations are served on their modelled restJson1 routes,
POST, DELETE and GET /tag/{resourceArn}, for a table bucket's ARN or a
table's ARN. They read and change the tags the create operations store,
the same ones IAM reads for aws:ResourceTag conditions, so a tag set
with TagResource is what the next request's condition sees. The IAM
route and action tables already mapped the routes to
s3tables:TagResource, UntagResource and ListTagsForResource. Like S3
Tables' other routes, /tag is rewritten only for a request signed for
s3tables, so a path-style S3 request for a bucket named tag still
reaches S3.

A table keeps its tags through a rename, as its ARN ends in a minted id,
and tagging leaves its versionToken. An unknown table bucket answers
NotFoundException "The specified bucket does not exist.", and a table
ARN whose table or bucket is missing "The specified table does not
exist.", as AWS does.

TagResource refuses with BadRequestException a missing or non-object
tags member, a value that is not a string, a key beginning with aws:, a
key outside the tag character set, a key or value outside the modelled
lengths (in Smithy's validation wording), or more than 50 tags on the
resource counting the ones it already has. The aws:, character set, key
length and 50-tag messages are the ones AWS answers. CreateTableBucket
and CreateTable now apply the same rules to the tags they are given,
and no longer store a null or non-string value as its text.

TagResource and UntagResource build the new tags apart and restore the
old ones if the save throws, so a failed WAL write leaves nothing
visible to ListTagsForResource or IAM resource-tag conditions.

Tag condition keys come from generated data, and that table covers only
the IAM namespace, so S3 Tables' TagResource and UntagResource stay
without aws:RequestTag and aws:TagKeys, as most services' tagging
actions do.
2026-11-29 10:23:51 -04:00

98 lines
4.7 KiB
Markdown

# S3 Tables
**Protocol:** REST JSON
**Signing service:** `s3tables`
**Endpoint:** `http://localhost:4566`
Floci emulates the S3 Tables control plane for local development, Terraform
convergence, and SDK integration tests. It is a separate AWS service from S3:
S3 Tables requests are signed as `s3tables` and use REST JSON routes such as
`/buckets` and `/tables/{tableBucketARN}/{namespace}`.
## Scope
This service stores table-bucket, namespace, table, policy, maintenance
configuration, and metadata-location state, and gives every table a warehouse:
a bucket of its own, named like the ones AWS creates (`<id>--table-s3`), which
`GetTable` and `GetTableMetadataLocation` report as `warehouseLocation`. An
Iceberg client such as Spark's `S3TablesCatalog` writes the table's data and
metadata files there through Floci's S3 and commits each new metadata file
with `UpdateTableMetadataLocation`. Deleting the table deletes its warehouse
and everything in it, every object version included. A warehouse bucket is the
table's storage, not a general purpose bucket, so `ListBuckets` leaves it out. Floci does not run an Iceberg engine itself: compaction,
snapshot expiry, replication, data encryption, and metrics are outside
this implementation.
A table's ARN ends in an id Floci mints when it creates the table
(`arn:aws:s3tables:<region>:<account>:bucket/<bucket>/table/<id>`), as AWS's
do, so two tables of one name in different namespaces have their own ARNs, and
a rename keeps it. `GetTable` takes either `tableArn` or the table bucket's
ARN, namespace and name. A table created by an earlier Floci keeps the ARN it
was stored with, which ends in its name.
## Supported operations
| Area | Operations |
|---|---|
| Table buckets | CreateTableBucket, GetTableBucket, ListTableBuckets, DeleteTableBucket |
| Bucket encryption | GetTableBucketEncryption |
| Bucket policy | PutTableBucketPolicy, GetTableBucketPolicy, DeleteTableBucketPolicy |
| Bucket storage class | GetTableBucketStorageClass |
| Bucket maintenance | PutTableBucketMaintenanceConfiguration, GetTableBucketMaintenanceConfiguration |
| Namespaces | CreateNamespace, GetNamespace, ListNamespaces, DeleteNamespace |
| Tables | CreateTable, GetTable, ListTables, DeleteTable, RenameTable |
| Metadata location | GetTableMetadataLocation, UpdateTableMetadataLocation |
| Table policy | PutTablePolicy, GetTablePolicy, DeleteTablePolicy |
| Table maintenance | PutTableMaintenanceConfiguration, GetTableMaintenanceConfiguration |
| Tags | TagResource, UntagResource, ListTagsForResource |
The tag operations take a table bucket's ARN or a table's ARN. They read and
change the same tags `CreateTableBucket` and `CreateTable` store, which IAM
also reads for `aws:ResourceTag/<key>` conditions. A table keeps its tags
through a rename, and tagging leaves its `versionToken` as it is. A resource
holds at most 50 tags, and keys beginning with `aws:` are refused, on create as
on `TagResource`.
Tables must use `ICEBERG` format. `UpdateTableMetadataLocation` implements
optimistic concurrency: supply the table's current `versionToken`; a stale
token returns `ConflictException`.
`GetTableBucketEncryption` returns the encryption configuration stored by
`CreateTableBucket`, including a configured KMS key ARN. Buckets created
without an explicit configuration, including those loaded from older
snapshots, report `AES256`. This is configuration readback; Floci does not
encrypt table data or perform KMS cryptographic operations. Updating or
deleting a bucket's encryption configuration is not implemented.
## Example
```bash
export AWS_ENDPOINT_URL=http://localhost:4566
export AWS_DEFAULT_REGION=us-east-1
export AWS_ACCESS_KEY_ID=test
export AWS_SECRET_ACCESS_KEY=test
bucket_arn=$(aws s3tables create-table-bucket --name local-warehouse --query arn --output text)
aws s3tables create-namespace --table-bucket-arn "$bucket_arn" --namespace analytics
aws s3tables create-table \
--table-bucket-arn "$bucket_arn" \
--namespace analytics \
--name events \
--format ICEBERG
```
`GetTableBucketStorageClass` returns the storage-class configuration supplied to
`CreateTableBucket`. An omitted configuration, including in older snapshots,
reports `STANDARD`; an explicit `INTELLIGENT_TIERING` setting is preserved.
This is bucket configuration readback only. Storage-class updates, per-table
storage-class reads and inheritance, and physical tier transitions are not
implemented.
## Configuration
| Variable | Default | Description |
|---|---|---|
| `FLOCI_SERVICES_S3TABLES_ENABLED` | `true` | Enables the S3 Tables REST JSON service. |
| `FLOCI_STORAGE_SERVICES_S3TABLES_MODE` | Global storage mode | Optional per-service storage-mode override. |
| `FLOCI_STORAGE_SERVICES_S3TABLES_FLUSH_INTERVAL_MS` | `5000` | Persistence flush interval for hybrid storage. |