Skip to main content

Prepare the bucket in AWS

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.
  • You need permission in AWS to create buckets, edit bucket policies, and create event notifications.

Steps

  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.
  4. In AWS, create a bucket in the region us-east-1, or choose an existing bucket in that region. See Creating a bucket.
  5. Add the following statement to the bucket policy. If the bucket already has a policy, add the statement to its Statement list. See Adding a bucket policy by using the Amazon S3 console.
  6. Replace <processor-role-arn> with the value of Processor Role ARN. Replace <bucket-name> with the name of the bucket.
  7. Save the bucket policy.
  8. Create an event notification on the bucket with the following settings. See Enabling and configuring event notifications using the Amazon S3 console.
    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, and the files are not read. Send the notification directly to the Zenskar SQS queue.
  9. Save the event notification.
Next, connect the bucket in Zenskar. See Connect the bucket in Zenskar. See Step 1 Configure your S3 bucket.

Prepare an ingestion-error bucket

This task is optional. With an ingestion-error bucket, Zenskar writes an error file for each file that it rejects.

Prerequisites

  • You need the value of Processor Role ARN from Settings > S3 Ingestion. See Prepare the bucket in AWS.
  • You need permission in AWS to create buckets and edit bucket policies.

Steps

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

Prerequisites

Steps

Zenskar does not test the bucket when you save. A wrong bucket name, bucket policy, or event notification gives no error here, and no usage events arrive. Check the AWS settings before you save, and 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.
The dashboard confirms the change. Zenskar creates the bucket connection of your organization. The screen shows Connected. Your S3 bucket shows the bucket names. 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. See Step 2 Enter your bucket details.

Change the bucket connection

Prerequisites

  • You need a role with the Can Read Organisation Config and Can Update Organisation Config permissions.
  • To move the usage-event collections to the new buckets, you also need the Can Read Usage Event and Can Update Usage Event 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.

Steps

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, and 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, as in steps 4 to 8.
  1. Go to Settings > S3 Ingestion, and 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. The dashboard confirms the change.
  4. Go to Usage > Usage Events. The S3 Ingestion column shows the usage-event collections with S3 ingestion.
  5. Click a usage-event collection with S3 ingestion.
  6. Under S3 Ingestion, click Edit.
  7. Click SAVE. You do not need to change the folders.
  8. Repeat steps 5 to 7 for each usage-event collection with S3 ingestion.
The dashboard confirms each change. S3 ingestion now reads the new bucket for each usage-event collection, and error files go to the new ingestion-error bucket. See Step 2 Enter your bucket details.

Disconnect the bucket

Prerequisites

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

Steps

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. The dashboard asks you to confirm.
  3. Click Disconnect.
The dashboard confirms the change, and 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, and 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. See Disconnect S3 Bucket dialog.

Check that S3 ingestion works

Prerequisites

Steps

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, and 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. Keep the file in the bucket until its usage events appear. If the processing fails, Zenskar can download the file again to retry it.
  3. In Zenskar, go to Usage > Usage Events, and click the usage-event collection.
  4. Click REFRESH TABLE.
The Events Table shows the usage events of the file. When no usage events appear, open the error file of the test file in the error folder. Webhook alerts can also report the result of each file. See Webhook alerts. See Troubleshooting.