Expand description
Amazon S3 connector.
Lists and downloads objects from an S3 bucket using the S3 REST API with AWS Signature V4 authentication. Implements pagination for large buckets, glob-based filtering on object keys, and supports custom endpoints for S3-compatible services (MinIO, LocalStack).
Uses only pure-Rust dependencies (hmac, sha2) for AWS signing — no
C library dependencies like aws-lc-sys, making it compatible with
all build environments including Nix.
§Configuration
[connectors.s3.runbooks]
bucket = "acme-docs"
prefix = "engineering/runbooks/"
region = "us-east-1"
include_globs = ["**/*.md"]
# endpoint_url = "http://localhost:9000" # MinIO§Environment Variables
Credentials are read from environment variables:
AWS_ACCESS_KEY_ID— requiredAWS_SECRET_ACCESS_KEY— requiredAWS_SESSION_TOKEN— optional (for temporary credentials / IAM roles)
§Authentication
All S3 requests are signed using
AWS Signature Version 4.
The signing implementation uses HMAC-SHA256 (hmac + sha2 crates).
§Pagination
Large buckets (1000+ objects) are handled automatically via the
ListObjectsV2 continuation token mechanism.
§Content Type Detection
File extensions are mapped to MIME types:
| Extension | MIME Type |
|---|---|
.md | text/markdown |
.txt | text/plain |
.json | application/json |
.yaml, .yml | text/yaml |
.rst | text/x-rst |
.html, .htm | text/html |
| Other | text/plain |
Structs§
- AwsCredentials 🔒
- AWS credentials loaded from environment variables.
- S3Connector
- An S3 connector instance that implements the
Connectortrait. - S3Object 🔒
- Metadata for a single S3 object, parsed from
ListObjectsV2XML response.
Functions§
- build_
globset 🔒 - Build a [
GlobSet] from a list of glob pattern strings. - derive_
signing_ 🔒key - Derive the AWS SigV4 signing key for a given date, region, and service.
- detect_
content_ 🔒type - Detect MIME content type from a file extension.
- download_
object 🔒 - Download a single object’s content from S3 using a signed GET request.
- extract_
xml_ 🔒value - Extract the text content of an XML tag (simple, non-nested).
- hex_
hmac_ 🔒sha256 - Compute hex-encoded HMAC-SHA256.
- hex_
sha256 🔒 - Compute the hex-encoded SHA-256 hash of data.
- hmac_
sha256 🔒 - Compute HMAC-SHA256 of data with the given key.
- list_
objects 🔒 - List all objects in the configured S3 bucket, handling pagination.
- parse_
list_ 🔒objects_ response - Parse a
ListObjectsV2XML response into a list ofS3Objects. - s3_host 🔒
- Compute the S3 hostname for the configured bucket and region.
- scan_s3
- Scan an S3 bucket and produce
SourceItems. - uri_
encode 🔒 - URI-encode a string per RFC 3986 (used in SigV4 canonical requests).