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

Destinations

Connect Delta Lake on S3 as a destination

Connect an S3 bucket to Artie with an AWS service account. Your pipeline writes each table as a Delta table: Parquet data files with a transaction log.

Create a service account

Run this Terraform script in your AWS account. It creates an IAM user named artie-transfer, a policy for your bucket, and an access key.

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
}

Replace your-bucket-name with your bucket in both Resource lines, and set region to your AWS Region. The KMS statement applies only to a bucket encrypted with KMS: fill in your-region, your-account-id and your-kms-key-id. The access_key_id and secret_access_key outputs are the static credentials you enter in Artie.

To use Role assumption instead of an access key, create an IAM role and attach the same policy to it. Then add this trust policy to the role, so Artie can assume it.

JSON
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "AWS": "arn:aws:iam::788826912768:user/ci"
      },
      "Action": "sts:AssumeRole",
      "Condition": {
        "StringEquals": {
          "sts:ExternalId": "my-external-id"
        }
      }
    }
  ]
}

The Principal is Artie’s AWS identity. On a bring your own cloud (BYOC) data plane, trust the IAM identity of the data plane’s AWS credentials instead.

The Condition block is optional. Include it only when you enter an AWS external ID in Artie, and replace my-external-id with that exact value.

Connect Delta Lake in Artie

Pipeline setup has no Prepare destination step for Delta Lake, so create the service account before you start.

  1. Choose the destination

    In pipeline setup, on Choose destination, select Delta Lake (S3).

  2. Enter the settings

    On Connect and verify, fill in the required settings and any optional settings.

  3. Verify the destination

    Select Verify destination. The status reads Destination verified.

  4. Continue

    Select Continue.

Verify destination stays disabled until the pipeline has tables. To verify at a later time, select Verify later.

To change these settings on an existing pipeline, open the Destination: Delta Lake (S3) tab on the pipeline page. The fields have the same labels.

Required settings

Choose an Authentication method, then fill in the fields for that method.

FieldApplies toValue
AWS access key IDStatic credentialsThe access_key_id output of the service account script.
AWS secret access keyStatic credentialsThe secret_access_key output of the service account script.
AWS role ARNRole assumptionThe IAM role Artie assumes, for example arn:aws:iam::123456789012:role/YourRole.
AWS regionBoth methodsThe AWS Region Artie uses to reach the bucket. Select it from the list.
Bucket nameBoth methodsThe S3 bucket Artie writes to.

Optional settings

Every field in this table is optional.

FieldDefaultWhat it does
AWS external ID (optional)NoneThe external ID Artie sends when it assumes the role. Shown with Role assumption.
Folder name (optional)NoneStores every table under this folder in the bucket.
Table name separator/Joins the database, schema and table names into the table’s folder path.
Checkpoint interval (optional)10The number of commits between Delta checkpoints for each table. -1 turns checkpoints off.
Enable compactionOffRewrites small Parquet files into larger ones on a schedule, then vacuums the table.

Compaction

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

Artie groups files under 256 MB into sets of at least 2 files that total under 512 MB, and rewrites each set as one file. Files of 256 MB or more are left as they are. Artie checks for due tables every 60 seconds and compacts one table per check.

Two more settings appear when compaction is on:

  • Compaction frequency: how often each table is compacted. The options are Hourly, Every 6 hours, Every 12 hours, Daily (recommended) and Weekly. The default is Daily.
  • Quiet window (optional): set Start (UTC) and End (UTC) to run compaction only between those times. Leave both blank to allow it anytime.

A quiet window needs both times, and they must differ. A window whose start is later than its end runs past midnight, for example 22:00 to 02:00.

Vacuum

When Enable compaction is on, Artie vacuums each table after each compaction run. Vacuum 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 script in Create a service account 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 writes a Delta checkpoint file to _delta_log after every N commits to a table, where N is the checkpoint interval. The default is 10.

A checkpoint lets readers load the table’s state without reading every commit file in the log. Each checkpoint is one more Parquet file to write. A lower interval adds write work, and a higher interval leaves readers more commit files to read. If a checkpoint write fails, the commit still succeeds and the table stays readable.

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
BUCKET_NAME/FOLDER_NAME/TABLE_PATH/_delta_log/
BUCKET_NAME/FOLDER_NAME/TABLE_PATH/DATA_FILE.parquet

TABLE_PATH is the database, schema and table names joined with the table name separator. With the default /, it is db/schema/tableName. DATA_FILE is a numeric timestamp, an underscore and 4 random characters. Files written by compaction start with delta_compact_ instead.

This example uses bucket artie, folder foo and table db.schema.orders:

Text
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. Data files are Parquet with GZIP compression.

Spark, Databricks, DuckDB and delta-rs read the table from this folder. Query the table through its Delta log, and don’t list the Parquet files directly. The folder also holds files that the log no longer references, until vacuum removes them.

Column types

Artie records these Delta types in each table’s schema.

Source valueDelta type
Booleanboolean
Integerlong
Floatfloat
Doubledouble
Decimal with precision from 1 to 76decimal(p,s)
Decimal with precision over 76, or no precisionstring
Datedate
Timestamp with time zonetimestamp
Timestamp without time zonetimestamp_ntz
Arrayarray of string
Time, UUID, JSON object, string and every other typestring

A table with a timestamp_ntz column declares Delta reader version 3, writer version 7 and the timestampNtz table feature. Every other table declares reader version 1 and writer version 2.

Next steps

Was this page helpful?