# Send OpenTelemetry to Amazon S3 without a Collector

Point your OpenTelemetry SDK or Collector at Send2Bucket and authenticate with a stream API key. Send2Bucket writes logs, spans and metrics to your S3 bucket as gzip NDJSON, one object per delivery batch, at least once a minute while data flows.

## How it works

```text
SDK or Collector ──OTLP/HTTP or gRPC──▶ api.send2bucket.com ──60 s or 16 MiB──▶ s3://<bucket>/<prefix>/s2b/…
```

- A `200`, or gRPC `OK`, means the batch is stored durably and will be delivered at least once. See [Delivery semantics](../delivery-semantics.md).
- Each log record, span and metric becomes one NDJSON line, with its resource and scope copied onto the line.
- Objects sit under `date=YYYY-MM-DD/hour=HH/` folders, so a query that filters on a day reads only that day's objects.

## 1. Connect the bucket

Create an ingestion stream in the [dashboard](pathname:///app/) and add an Amazon S3 destination: the bucket, its region, a prefix, and an IAM role that Send2Bucket assumes with an external ID. The role needs `s3:PutObject` and `s3:GetObject` under `<prefix>/s2b/`. [Amazon S3](../destinations/aws-s3.md) has the trust and permissions policies.

Copy the stream's API key when the dashboard shows it:

```bash
export S2B_API_KEY=s2b_ingest_...
```

## 2. Point your SDKs at Send2Bucket

OpenTelemetry SDKs read the standard exporter variables, so a service that already exports OTLP needs no code change. Set these in its environment:

```bash
export OTEL_SERVICE_NAME=checkout
export OTEL_EXPORTER_OTLP_ENDPOINT=https://api.send2bucket.com
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_HEADERS="authorization=Bearer%20$S2B_API_KEY"
```

- The SDK appends `/v1/traces`, `/v1/logs` and `/v1/metrics` to the endpoint.
- `http/protobuf` is the smallest on the wire; `http/json` works too, and is billed the same. gRPC works too; the [API reference](../api-reference.md#otlp-grpc) has the endpoint.
- The space after `Bearer` is percent-encoded, as the specification requires for header values.
- `OTEL_SERVICE_NAME` sets the `service.name` resource attribute that the queries below group by.

## Or keep the Collector you run

If services already export to a Collector for sampling or enrichment, keep it and replace the [OpenTelemetry Collector S3 exporter](../compare/send2bucket-vs-opentelemetry-collector-s3-exporter.md) (`awss3`) with an `otlphttp` exporter:

```yaml
receivers:
  otlp:
    protocols:
      grpc:
      http:

exporters:
  otlphttp/s2b:
    endpoint: https://api.send2bucket.com
    headers:
      authorization: Bearer ${env:S2B_API_KEY}
    compression: gzip

service:
  pipelines:
    traces:
      receivers: [otlp]
      exporters: [otlphttp/s2b]
    logs:
      receivers: [otlp]
      exporters: [otlphttp/s2b]
    metrics:
      receivers: [otlp]
      exporters: [otlphttp/s2b]
```

The Collector's sending queue still applies, and the exporter retries the `429` and `503` responses Send2Bucket returns when the organization is over its plan's quota or Send2Bucket is backed up.

## 3. Check the first objects

The first object appears within about a minute of the first export:

```bash
aws s3 ls s3://<bucket>/<prefix>/s2b/ --recursive | head
```

```text
2026-11-21 16:23:01       1511 raw/s2b/stream=<stream_id>/date=2026-11-21/hour=16/dlv_00361iu694qpt8t4l76dhthf2lofq.ndjson.gz
```

If nothing arrives, open the stream in the dashboard: it shows the destination's status, its last error and the age of the oldest pending batch. A role that refuses access turns the destination `blocked` and keeps the batches until access is fixed.

## 4. Query the telemetry

[DuckDB](../querying/duckdb.md) reads the objects in place. This view keeps the OpenTelemetry records and a macro pulls `service.name` out of the resource's attribute list:

```sql
INSTALL httpfs; LOAD httpfs;
CREATE SECRET s2b (TYPE s3, PROVIDER credential_chain, REGION '<region>');

CREATE VIEW otel AS
SELECT * FROM read_json(
  's3://<bucket>/<prefix>/s2b/stream=*/date=*/hour=*/*.ndjson.gz',
  format = 'newline_delimited',
  hive_partitioning = true,
  columns = {v: 'INTEGER', delivery_batch_id: 'VARCHAR', batch_id: 'VARCHAR',
             received_at: 'TIMESTAMPTZ', signal: 'VARCHAR',
             resource: 'JSON', scope: 'JSON', data: 'JSON'})
WHERE signal IN ('log', 'span', 'metric');

CREATE MACRO service(resource) AS (
  SELECT a->>'$.value.stringValue'
  FROM unnest(json_extract(resource, '$.attributes[*]')) AS t(a)
  WHERE a->>'$.key' = 'service.name');
```

Records per service and signal today:

```sql
SELECT service(resource) AS service, signal, count(*) AS records
FROM otel
WHERE date = current_date
GROUP BY ALL
ORDER BY service, signal;
```

Spans with an error status. Enums are integers in the OTLP JSON mapping, and `2` is `STATUS_CODE_ERROR`:

```sql
SELECT service(resource) AS service, data->>'$.name' AS span, count(*) AS errors
FROM otel
WHERE signal = 'span' AND (data->>'$.status.code')::INTEGER = 2
GROUP BY ALL
ORDER BY errors DESC;
```

p95 latency per operation. Timestamps are nanosecond strings, so cast before subtracting:

```sql
SELECT service(resource) AS service,
       data->>'$.name' AS span,
       round(quantile_cont(((data->>'$.endTimeUnixNano')::HUGEINT
                            - (data->>'$.startTimeUnixNano')::HUGEINT) / 1e6, 0.95), 1) AS p95_ms,
       count(*) AS spans
FROM otel
WHERE signal = 'span'
GROUP BY ALL
ORDER BY p95_ms DESC;
```

Everything one trace recorded, spans and logs together. Logs emitted inside a span carry its `traceId`:

```sql
SELECT signal,
       make_timestamp_ns(coalesce(data->>'$.startTimeUnixNano', data->>'$.timeUnixNano')::BIGINT) AS ts,
       coalesce(data->>'$.name', data->>'$.body.stringValue') AS what,
       data->>'$.severityText' AS severity
FROM otel
WHERE data->>'$.traceId' = '<trace_id>'
ORDER BY ts;
```

```text
┌─────────┬───────────────────────────────┬────────────────┬──────────┐
│ signal  │              ts               │      what      │ severity │
├─────────┼───────────────────────────────┼────────────────┼──────────┤
│ span    │ 2026-11-21 16:22:58.34860872  │ POST /orders   │ NULL     │
│ log     │ 2026-11-21 16:22:58.348628736 │ order received │ INFO     │
│ span    │ 2026-11-21 16:22:58.348708223 │ charge card    │ NULL     │
│ log     │ 2026-11-21 16:22:58.448853504 │ card declined  │ ERROR    │
└─────────┴───────────────────────────────┴────────────────┴──────────┘
```

For [Athena](../querying/athena.md), define the table with partition projection as that guide shows; it answers the same questions in Athena SQL. [Query gzip JSON logs in S3 with Athena](./query-gzip-json-logs-in-s3-with-athena.md) explains the table properties step by step. [Query OpenTelemetry traces and logs in S3 with SQL](./query-otel-in-s3-with-sql.md) has more queries: slowest spans per service, log search by attribute and metric series. Other engines are listed under [Querying](../querying/index.md).

## What lands in the bucket

| `signal` | `data` holds | Fields you will query most |
|---|---|---|
| `span` | An OTLP `Span` | `traceId`, `spanId`, `parentSpanId`, `name`, `kind`, `startTimeUnixNano`, `endTimeUnixNano`, `status`, `attributes` |
| `log` | An OTLP `LogRecord` | `timeUnixNano`, `severityText`, `severityNumber`, `body`, `traceId`, `spanId`, `attributes` |
| `metric` | An OTLP `Metric` | `name`, `unit`, and one of `gauge`, `sum`, `histogram`, `exponentialHistogram`, `summary` with its data points |

Every line also has `resource` and `scope`. Attributes are lists of `{key, value}` and 64-bit integers are strings. [Delivery format](../delivery-format.md) has the envelope and an example line.

## Limits and costs

- **Size.** A request can be up to 8 MiB decompressed; a single log record, span or metric has no separate limit.
- **Billing.** Send2Bucket bills the stored JSON of each log record, span or metric it accepts. See [Plans and billing](../plans-and-billing.md). AWS bills storage and requests on your bucket.
- **Object count.** A busy stream writes about one object a minute, roughly 1,440 a day, plus one per 16 MiB.
- **Retention.** The role has no delete permission, so objects stay until you remove them. Set an S3 lifecycle rule on `<prefix>/s2b/` to expire or transition them.
- **Sampling.** Everything accepted is delivered. Sample in the SDK or the Collector if you need to.

## Other ways to get OpenTelemetry into S3

- [The Collector's S3 exporter](../compare/send2bucket-vs-opentelemetry-collector-s3-exporter.md): free, and you run and scale the Collectors.
- [Amazon Data Firehose](../compare/send2bucket-vs-amazon-data-firehose.md): cheaper per GB inside AWS, but it has no OTLP endpoint, so a Collector or agent still translates for it.
