Skip to main content

Prepare the bucket in AWS

Set up the S3 bucket that holds the files of usage events. Zenskar can then read the bucket. The bucket gets a bucket policy for the processor role and an event notification to the Zenskar SQS queue.

Prerequisites

  • You need a role with the Can Read Organisation Config permission. See Permissions.
  • You need permission in AWS to create buckets, edit bucket policies, and create event notifications.

Copy the Zenskar ARNs

  1. Go to Settings > S3 Ingestion. If the bucket connection already exists, click Edit.
  2. Under Step 1 Configure your S3 bucket, copy Processor Role ARN. Keep it for the bucket policy.
  3. Copy SQS Queue ARN. Keep it for the event notification.

Choose the bucket

  1. In AWS, create a bucket in the region us-east-1, or choose an existing bucket in that region. See Creating a bucket.

Add the bucket policy

  1. Add the following statement to the bucket policy. See Adding a bucket policy by using the Amazon S3 console. If the bucket already has a policy, add the statement to its Statement list.
  2. Replace <processor-role-arn> with the value of Processor Role ARN. Replace <bucket-name> with the name of the bucket.
  3. Save the bucket policy.

Add the event notification

Zenskar reads only the notifications that the bucket sends directly to the Zenskar SQS queue. A notification that passes through Amazon SNS or Amazon EventBridge never reaches Zenskar. The files are then not read. Send the notification directly to the Zenskar SQS queue.
  1. Create an event notification on the bucket with the following settings. See Enabling and configuring event notifications using the Amazon S3 console.
  2. Save the event notification.
Next, connect the bucket in Zenskar. See Connect the bucket in Zenskar.

Prepare an ingestion-error bucket

Set up an ingestion-error bucket. Zenskar then writes an error file for each file that it rejects. This task is optional.

Prerequisites

  • You need the value of Processor Role ARN. See Copy the Zenskar ARNs.
  • You need permission in AWS to create buckets and edit bucket policies.

Choose the bucket

  1. In AWS, create a bucket, or choose an existing bucket. It can be the bucket that holds the files of usage events. See Creating a bucket.

Add the bucket policy

  1. Add the following statement to the bucket policy. See Adding a bucket policy by using the Amazon S3 console. If the bucket already has a policy, add the statement to its Statement list.
  2. Replace <processor-role-arn> with the value of Processor Role ARN. Replace <error-bucket-name> with the name of the bucket.
  3. Save the bucket policy.
Next, enter the bucket in Ingestion Error Bucket (Optional) when you connect the bucket in Zenskar. See Connect the bucket in Zenskar.

Connect the bucket in Zenskar

Enter the bucket in Zenskar to create the bucket connection of the organization. Add the ingestion-error bucket in the same step.

Prerequisites

Enter the bucket details

Zenskar does not test the bucket when you save. A wrong bucket name, bucket policy, or event notification gives no error here. No usage events arrive. Check the AWS settings before you save. Check the first file afterward. See Check that S3 ingestion works.
Without an ingestion-error bucket, Zenskar keeps no record of the files that it rejects. To keep a record, enter an ingestion-error bucket before you save.
  1. Go to Settings > S3 Ingestion. The screen shows Not Connected.
  2. Under Step 2 Enter your bucket details, in S3 Bucket Name, enter the name of the bucket, without the s3:// prefix.
  3. Optional: In Ingestion Error Bucket (Optional), enter the name of the ingestion-error bucket, without the s3:// prefix.
  4. Click Save Config.
Zenskar confirms the change. The screen shows Connected. Your S3 bucket shows the bucket names. A bucket name has 3 to 63 characters: lowercase letters, digits, dots, and hyphens. It starts and ends with a letter or a digit. It cannot have the form of an IP address. When a name breaks these rules, the field shows the problem. Zenskar does not save. Next, turn on S3 ingestion for each usage-event collection whose files are in the bucket. See Set up S3 ingestion for a usage-event collection.

Change the bucket connection

Change the bucket or the ingestion-error bucket of the bucket connection. Then move each usage-event collection to the new buckets.

Prerequisites

  • You need a role with the Can Read Organisation Config and Can Update Organisation Config permissions. To move the usage-event collections, you also need Can Read Usage Event and Can Update Usage Event. See Permissions.
  • A new bucket must have its bucket policy and event notification. See Prepare the bucket in AWS.
  • A new ingestion-error bucket must have its bucket policy. See Prepare an ingestion-error bucket.

Change the bucket details

Each usage-event collection keeps the buckets that were connected when its S3 ingestion was last saved. After you change a bucket, S3 ingestion still reads the old bucket for each usage-event collection. Error files still go to the old ingestion-error bucket. To move a usage-event collection to the new buckets, save its S3 ingestion again.
  1. Go to Settings > S3 Ingestion. Click Edit. The fields show the current bucket names.
  2. Change S3 Bucket Name, Ingestion Error Bucket (Optional), or both. To remove the ingestion-error bucket, clear its field.
  3. Click Save Config. To discard the change, click Cancel.
Zenskar confirms the change.

Move the usage-event collections to the new buckets

  1. Go to Usage > Usage Events. The S3 Ingestion column shows the usage-event collections with S3 ingestion.
  2. Click a usage-event collection with S3 ingestion.
  3. Under S3 Ingestion, click Edit.
  4. Click SAVE. You do not need to change the folders.
  5. Repeat for each usage-event collection with S3 ingestion.
Zenskar confirms each change. S3 ingestion now reads the new bucket for the usage-event collection. Error files go to the new ingestion-error bucket.

Disconnect the bucket

Remove the bucket connection of the organization. S3 ingestion stops for every usage-event collection.

Prerequisites

  • You need a role with the Can Read Organisation Config and Can Update Organisation Config permissions. See Permissions.

Disconnect

Disconnecting turns off S3 ingestion on every usage-event collection. It also clears the folder and the error folder of each usage-event collection. Connecting a bucket again does not restore them. Before you disconnect, note the folders of each usage-event collection.
  1. Go to Settings > S3 Ingestion.
  2. Click Disconnect. Zenskar asks you to confirm.
  3. Click Disconnect.
Zenskar confirms the change. The screen shows Not Connected. Zenskar no longer reads the files that arrive in the bucket. The bucket policy and the event notification stay in AWS until you remove them there. To use S3 ingestion again, connect a bucket. Then turn on S3 ingestion for each usage-event collection. See Connect the bucket in Zenskar and Set up S3 ingestion for a usage-event collection.

Check that S3 ingestion works

Upload a test file to the folder of a usage-event collection. Check that its usage events arrive.

Prerequisites

Upload a test file

Zenskar reads a file only when its folder is exactly the folder of the usage-event collection. A file in a subfolder, or at the top level of the bucket, is not read. It gets no error file. Upload the file directly into the folder of the usage-event collection.
A file with the same content as a file that Zenskar already stored adds no usage events. To test again with the same rows, change one value in the file.
  1. Create a CSV file whose header row names every field of the data schema of the usage-event collection, including customer_id and timestamp. To start from the right columns, download the sample file of the usage-event collection. See Upload usage events from a CSV file.
  2. Upload the file to the folder of the usage-event collection, such as api_calls/test-2026-10-28.csv. See Uploading objects.
  3. In Zenskar, go to Usage > Usage Events. Click the usage-event collection.
  4. Click REFRESH TABLE. The Events Table shows the usage events of the file.
Keep the file in the bucket until its usage events appear. If the processing fails, Zenskar can download the file again to retry it.

When no usage events appear

  1. In the ingestion-error bucket, open the error folder of the usage-event collection. Without an error folder, open the folder errors.
  2. Open the error file whose name starts with the name of the test file. It names the error, or lists each rejected row.
  3. Correct the file. Upload it again.
If no error file exists, Zenskar did not read the file. Check the event notification, the folder of the file, and the .csv at the end of the file name. See Troubleshooting.
Webhook alerts can also report the result of each file. See Webhook alerts.