Skip to main content

S3 ingestion

S3 ingestion: usage events from files in Amazon S3

S3 ingestion is the import of usage events from files in an Amazon S3 bucket of your organization.
S3 ingestion is set for each usage-event collection on its own. It adds one more way to send usage events to that usage-event collection, alongside the other ways, such as its API endpoint and CSV files. See Concepts: How usage events work.
With S3 ingestion, your systems put usage data in files in your own bucket, and Zenskar fetches each new file as it arrives. S3 ingestion suits systems that already export usage data to files on a schedule. See Ways to send usage events. Two settings tell Zenskar which files to read and where their usage events go:
  • The bucket connection names the one bucket that Zenskar reads for your organization.
  • Each usage-event collection that uses S3 ingestion has its own folder in that bucket. Zenskar stores the rows of each file in the folder as usage events of that usage-event collection.
Zenskar reads only the files that arrive after S3 ingestion is set up. For example, a nightly job writes the API calls of October 1 to api_calls/2026-10-01.csv. The folder api_calls belongs to the usage-event collection api_calls, so each row of the file becomes one usage event of api_calls.

This conceptual diagram shows S3 ingestion as one of the ways that usage events reach a usage-event collection.

Bucket connections: one bucket for the organization

A bucket connection is the setting that tells Zenskar which S3 bucket of your organization stores the files of usage events.
Your organization can have one bucket connection. Its bucket must be in the AWS region us-east-1.
The bucket stays in your AWS account. Zenskar reads the files in it, and never changes or deletes them. Zenskar reads the bucket through two AWS resources of its own:
  • The processor role is the AWS IAM role that Zenskar uses to read the files in the S3 bucket that a bucket connection names.
  • The Zenskar SQS queue is the Amazon SQS queue of Zenskar that receives a notification when a new file arrives in the S3 bucket that a bucket connection names.
Two AWS settings on your bucket give these resources access, each through the ARN of its resource:

This conceptual diagram shows how Zenskar learns about a new file and reads it.

The event notification must go directly from the bucket to the Zenskar SQS queue. Zenskar ignores a notification that passes through Amazon SNS or Amazon EventBridge, so it never reads the file.
Zenskar does not check a bucket connection when it is saved, and the bucket connection counts as connected right away. A mistake in either AWS setting shows only when files arrive: Each usage-event collection keeps the bucket that was connected when its S3 ingestion was last set up. When the bucket connection changes to another bucket, Zenskar reads the new bucket for a usage-event collection only after its S3 ingestion is set up again.
Disconnecting the bucket connection turns off S3 ingestion on every usage-event collection, and clears the folder and the error folder of each one. Connecting a bucket again does not restore them. Note the folders of your usage-event collections before you disconnect.
See Prepare the bucket in AWS. See Connect the bucket in Zenskar.

Ingestion-error buckets: where rejected files go

An ingestion-error bucket is an S3 bucket of your organization in which Zenskar writes an error file for each file that S3 ingestion rejects. Zenskar rejects a file as a whole. One row that fails is enough, and the file then adds no usage events. See Files that S3 ingestion reads. An ingestion-error bucket is optional. Without one, Zenskar writes no error file. Your organization sets the ingestion-error bucket together with its bucket connection. It can be the same bucket or another bucket, and it must be in the AWS region us-east-1. Its bucket policy grants the processor role write access, so that Zenskar can write error files to it. An error file is a CSV file that Zenskar writes to an ingestion-error bucket about a file that S3 ingestion rejects. Zenskar writes one of two error files. In the name of an error file, <name> is the name of the rejected file without .csv, and <ID> identifies the processing of the file. Zenskar writes the error files of a usage-event collection to its error folder. Without an error folder, Zenskar writes them to the folder errors. For example, one row of api_calls/2026-10-01.csv has text in a number field, so Zenskar rejects the file. With no error folder, the error file is errors/2026-10-01_<ID>_errors.csv. A file that Zenskar does not read gets no error file, such as a file whose name does not end in .csv, or a file in a folder that belongs to no usage-event collection. See Prepare an ingestion-error bucket.

Folders of usage-event collections

S3 ingestion is on or off for each usage-event collection. A usage-event collection with S3 ingestion on has its own folder in your S3 bucket. Zenskar reads each new file in that folder. By default, the folder has the name of the API slug of the usage-event collection. Two usage-event collections cannot have the same folder. A folder is a path in the bucket, such as api_calls or usage/api_calls. The path has no trailing slash, and no part of it is . or ... Zenskar reads a file only when its folder matches the folder of a usage-event collection exactly. The folder of a file is the whole path before its name: An error folder is a folder of the ingestion-error bucket in which Zenskar writes the error files of one usage-event collection. The error folder is optional. A usage-event collection can have one only when your organization has an ingestion-error bucket. When the ingestion-error bucket is your S3 bucket itself, the error folder cannot be the folder of any usage-event collection.
Turning off S3 ingestion for a usage-event collection stops Zenskar from reading its folder right away, and clears its folder and its error folder. Turning S3 ingestion on again does not restore them. Note both folders before you turn S3 ingestion off.
See Set up S3 ingestion for a usage-event collection.

Files that S3 ingestion reads

S3 ingestion reads CSV files. Zenskar reads a file only when its name ends in .csv, in uppercase or lowercase letters, such as .CSV. Zenskar ignores every other file. The first row of a file is a header row that names the fields of the data schema of the usage-event collection:
  • The header names every field, including the root fields customer_id and timestamp.
  • The header names no column that the data schema does not have.
  • The columns can be in any order.
  • The data. prefix of a data field is optional. For example, the header region names the data field data.region.
Each value fits the data type of its field. See Data fields: the details that you add. A file can be at most 200 MB. A file without rows is rejected. Zenskar checks every row of a file before it stores any row, so a file is stored whole or not at all. See Ingestion-error buckets: where rejected files go.

This conceptual diagram shows how S3 ingestion processes one file.

Zenskar can skip a file whose content matches a file that it stored recently, but it does not guarantee to skip it. Sending the same file twice can store its usage events twice. Zenskar downloads a file when it processes it. If the processing fails for a temporary reason, Zenskar downloads the file again and retries. After the usage events of a file appear in the usage-event collection, you can delete the file from your bucket. See Check that S3 ingestion works.