Skip to contentManaged Kafka is live: Apache Kafka on AWS for half the cost of MSK

Destinations

Delta Lake (S3)

How to configure Delta Lake as a destination in Artie. With Delta Lake, Artie writes incoming changes in Parquet format to the specified S3 bucket, checkpointed as a Delta table.

Required settings

  • Bucket name
  • AWS region
  • Credentials: static access keys (Static credentials) or an IAM role Artie assumes (Role assumption)

Optional settings

  • Folder name
  • Table name separator (default: /)
  • Checkpoint interval (default: 10, -1 turns checkpoints off)
  • Enable compaction, with a compaction frequency and a UTC quiet window

Bucket structure

Artie writes each table to its own folder in the bucket. The folder holds the table’s Parquet data files and its _delta_log transaction log:

Text
-- tableName is db, schema and table joined with the table name separator (default: db/schema/tableName)
{{bucketName}}/{{folderName}}/{{tableName}}/_delta_log/
{{bucketName}}/{{folderName}}/{{tableName}}/{{unixTimestampMs}}_{{randomString(4)}}.parquet

-- partitioned table: data files go in one subfolder per partition value
{{bucketName}}/{{folderName}}/{{tableName}}/{{partitionColumn}}={{value}}/{{unixTimestampMs}}_{{randomString(4)}}.parquet

-- example
artie/foo/db/schema/orders/_delta_log/
artie/foo/db/schema/orders/1792776403000_abc1.parquet

If you leave Folder name empty, the table folder sits at the root of the bucket. Query the table through its Delta log, not by listing Parquet files: the folder also holds files that the log no longer references, until vacuum removes them.

Compaction

When Enable compaction is on, Artie periodically rewrites each table’s small Parquet files into fewer, larger files. Compaction doesn’t change your data.

  • Compaction frequency: Hourly, Every 6 hours, Every 12 hours, Daily (the default), or Weekly.
  • Quiet window (optional): set Start (UTC) and End (UTC) to keep compaction to off-peak hours. Leave both blank to allow it anytime.

Vacuum

When Enable compaction is on, Artie vacuums each table after compacting it: it deletes Parquet files that the Delta log stopped referencing more than 7 days (168 hours) ago. Files are retained for those 7 days so readers using Delta time travel, or a query that started before a merge, can still open them. Without compaction, unreferenced files stay in the bucket.

Vacuum needs s3:DeleteObject on the bucket, which the Service account script on this page grants. Without it, replication keeps running but nothing is deleted, so unreferenced files pile up and storage grows. Add the permission to the policy to fix it.

Checkpoint interval

Artie periodically writes a Delta Lake checkpoint file to consolidate the transaction log. The checkpoint interval controls how many commits occur between each checkpoint. A lower value means more frequent checkpoints (faster reads, more write overhead); a higher value means fewer checkpoints (less write overhead, slower cold reads). The default is 10.

Service account script
HCL
provider "aws" {
  region = "us-east-1" # Your AWS Region
}

resource "aws_iam_user" "artie_transfer" {
  name = "artie-transfer" # Your service account name
}

resource "aws_iam_policy" "s3_read_write_policy" {
  name        = "s3-read-write-policy"
  description = "Ability to list, read, write and delete in the bucket"

  policy = jsonencode({
    Version = "2012-10-17"
    Statement = [
      {
        Effect = "Allow"
        Action = [
          "s3:ListBucket",
          "s3:GetEncryptionConfiguration"
        ]
        Resource = "arn:aws:s3:::your-bucket-name"
      },
      {
        Effect = "Allow"
        Action = [
          "s3:GetObject",
          "s3:PutObject",
          "s3:DeleteObject" # Vacuum deletes files the Delta log no longer references
        ]
        Resource = "arn:aws:s3:::your-bucket-name/*"
      },
      // If the bucket is encrypted with KMS:
      {
        Effect = "Allow",
        Action = [
          "kms:GenerateDataKey",
          "kms:Decrypt",
        ],
        Resource = [
          "arn:aws:kms:your-region:your-account-id:key/your-kms-key-id",
        ]
      }
    ]
  })
}

resource "aws_iam_user_policy_attachment" "user_policy_attachment" {
  user       = aws_iam_user.artie_transfer.name
  policy_arn = aws_iam_policy.s3_read_write_policy.arn
}

resource "aws_iam_access_key" "artie_transfer_key" {
  user = aws_iam_user.artie_transfer.name
}

output "access_key_id" {
  value     = aws_iam_access_key.artie_transfer_key.id
  sensitive = false
}

output "secret_access_key" {
  value     = aws_iam_access_key.artie_transfer_key.secret
  sensitive = true
}