Skip to main content
Streams are ordered sequences of records within a basin. Each stream has its own configuration for storage class, retention, and timestamping.

List streams

List all streams in a basin:
Output:

Using S2 URI format

You can also specify the basin using an S2 URI:

Filter by prefix

List only streams matching a prefix:
Output:

Pagination

Limit results:
Start after a specific stream:
Disable auto-pagination:

Using the ls shortcut

The ls command lists streams when given a basin name or URI:

Create a stream

Create a stream with default settings:
Output:

Configure stream properties

Set storage class, retention, and timestamping:

Enable auto-deletion of empty streams

Automatically delete the stream when empty:
The stream will be deleted 1 hour after it becomes empty (no records remain after retention policy is applied).

Get stream configuration

View the current configuration of a stream:
Output (table format):

Reconfigure a stream

Update an existing stream’s configuration:
Output:
Only specified fields are updated; other settings remain unchanged.

Available reconfiguration options

  • --storage-class - Storage class (standard, express)
  • --retention-policy - Retention policy (e.g., 7d, 30d, infinite)
  • --timestamping-mode - Timestamping mode (client-prefer, client-require, arrival)
  • --timestamping-uncapped - Allow uncapped timestamps (true/false)
  • --delete-on-empty-min-age - Minimum age before deleting empty streams (e.g., 1d)
Storage class changes only apply to newly appended records. Existing records retain their original storage class.

Delete a stream

Deleting a stream is irreversible and will delete all records in the stream.
Delete a stream:
Output:
Deletion is asynchronous. The stream is marked for deletion and eventually removed.

Check stream tail position

Get the current tail position (next sequence number and last timestamp):
Output:
This shows:
  • Next sequence number: 12345
  • Timestamp of last record: 1704067200000 (milliseconds since Unix epoch)

Trim a stream

Set a trim point to delete old records:
This deletes all records with sequence numbers less than 10000. Output:

Trim with fencing token

Enforce a fencing token when trimming:

Trim with sequence number match

Only trim if the next sequence number matches the expected value:
This prevents accidental trims if records have been appended since you last checked.
Trimming is eventually consistent. Trimmed records may be visible briefly before deletion completes.

Fence a stream

Set a fencing token to coordinate writes:
Output:
After fencing, subsequent appends must provide the matching fencing token or they will be rejected.

Enforce previous fencing token

Only set the new token if the current token matches:

Fence with sequence number match

See Fencing for details on coordination patterns.

Common workflows

Create a stream for real-time events

Create a stream for archival logs

Migrate stream to different storage class

1

Create new stream with desired storage class

2

Copy records from old stream

3

Update application to use new stream

Deploy application changes to write to events-new.
4

Delete old stream

Cleanup old records periodically

Configuration reference

Storage classes

  • standard - Cost-optimized, higher latency
  • express - Low-latency, higher cost

Retention policies

Examples:

Timestamping modes

  • client-prefer - Use client timestamp if provided, otherwise server timestamp
  • client-require - Reject records without client timestamp
  • arrival - Always use server arrival timestamp
See Timestamping for details.

Delete-on-empty

Automatically delete streams when they become empty:
The stream must be empty (all records deleted by retention) for at least the specified duration before deletion.

Examples

List all event streams

Create stream with all options

Check tail before appending