|
1 | 1 | # AWS S3 sink |
2 | 2 |
|
3 | | -Decode transactions and write each one as an object into an S3 bucket. |
| 3 | +Write each block's raw CBOR as an object into an S3 bucket. |
4 | 4 |
|
5 | 5 | ## Pipeline |
6 | 6 |
|
7 | 7 | ```mermaid |
8 | 8 | flowchart LR |
9 | | - src[N2N source] --> f1[ParseCbor] --> sink[AwsS3 sink] |
| 9 | + src[N2N source] --> sink[AwsS3 sink] |
10 | 10 | ``` |
11 | 11 |
|
12 | 12 | - **Source** — `N2N`: mainnet relay, starting from the chain tip. |
13 | | -- **Filters** — `ParseCbor`: decodes the raw transaction CBOR into structured records. |
14 | | -- **Sink** — `AwsS3`: writes objects under `prefix` in `bucket` (`region`). |
| 13 | +- **Sink** — `AwsS3`: writes one object per block under `prefix` in `bucket` (`region`), |
| 14 | + keyed by `slot.hash`. The `AwsS3` sink stores the block CBOR as-is, so the example runs |
| 15 | + no filters — a `ParseCbor` / `SplitBlock` filter would change the record type and the |
| 16 | + sink would reject it. |
15 | 17 |
|
16 | 18 | ## Prerequisites |
17 | 19 |
|
18 | 20 | - Built with the `aws` feature. |
19 | | -- AWS credentials available to the process (env vars, profile, or instance role) with |
20 | | - permission to write to the bucket. |
21 | | -- Edit `region`, `bucket`, and `prefix` in `daemon.toml` to match your bucket. |
22 | 21 |
|
23 | | -## Run |
| 22 | +## Run standalone (LocalStack) |
| 23 | + |
| 24 | +The included `docker-compose.yml` starts [LocalStack](https://www.localstack.cloud/) and |
| 25 | +provisions the `my-bucket` bucket, so the example runs without a real AWS account: |
24 | 26 |
|
25 | 27 | ```sh |
26 | 28 | cd examples/aws_s3 |
| 29 | +docker compose up -d |
| 30 | +``` |
| 31 | + |
| 32 | +Point the AWS SDK at LocalStack with dummy credentials, then run Oura: |
| 33 | + |
| 34 | +```sh |
| 35 | +export AWS_ENDPOINT_URL=http://s3.localhost.localstack.cloud:4566 |
| 36 | +export AWS_ACCESS_KEY_ID=test AWS_SECRET_ACCESS_KEY=test AWS_REGION=us-east-1 |
27 | 37 | cargo run --features aws --bin oura -- daemon --config daemon.toml |
28 | 38 | ``` |
29 | 39 |
|
30 | 40 | (or `oura daemon --config daemon.toml` with a binary built with the `aws` feature.) |
| 41 | + |
| 42 | +Inspect the objects Oura wrote: |
| 43 | + |
| 44 | +```sh |
| 45 | +docker exec localstack-s3 awslocal s3 ls s3://my-bucket/mainnet/ |
| 46 | +``` |
| 47 | + |
| 48 | +## Run against real AWS |
| 49 | + |
| 50 | +Skip the compose step and the `AWS_ENDPOINT_URL` export. Provide real credentials (env |
| 51 | +vars, profile, or instance role) with permission to write to the bucket, and edit |
| 52 | +`region`, `bucket`, and `prefix` in `daemon.toml` to match it. |
0 commit comments