Iceberg
Connect Amazon S3 Tables as an Iceberg destination
Create an IAM service account for your S3 table bucket, connect it to an Artie pipeline, and name tables so S3 Tables accepts them.
Required settings
Artie needs these values to write to S3 Tables. Each field name matches its label in the Artie dashboard.
| Field | Required | What to enter |
|---|---|---|
| Catalog type | Yes | AWS S3 Tables. |
| AWS access key ID | Yes | The aws_access_key_id output of the service account script. |
| AWS secret access key | Yes | The aws_secret_access_key output of the service account script. |
| AWS Region | Yes | The AWS Region of your table bucket, for example us-east-1. |
| Table bucket ARN | Yes | The ARN of your table bucket, for example arn:aws:s3tables:us-east-1:123456789012:bucket/my-table-bucket. |
| Namespace name | Yes, unless you pick Multiple namespaces | The namespace Artie writes to. Pick one from the list or create one. |
Find your table bucket ARN
In the AWS console, open Amazon S3, then select Table buckets. The Amazon Resource Name (ARN) column shows the ARN of each table bucket.
The ARN must include a Region, and its resource must start with bucket/.
Create a service account
The service account needs S3 Tables API access. This Terraform script creates an IAM policy, an IAM user with that policy, and an access key for the user:
variable "table_bucket_name" {
type = string
}
variable "service_account_name" {
type = string
}
// If the S3 Tables bucket is encrypted with KMS. Otherwise, remove the
// kms_key_id, region and account_id variables and the KMS statement below.
variable "kms_key_id" {
type = string
}
// The Region and AWS account ID of the KMS key.
variable "region" {
type = string
}
variable "account_id" {
type = string
}
resource "aws_iam_policy" "s3_tables_policy" {
name = "S3TablesPolicy"
description = "Policy that grants access to S3 tables and related resources"
policy = jsonencode({
Version = "2012-10-17",
Statement = [
{
Effect = "Allow",
Action = [
"s3tables:CreateTable",
// DeleteTable is used to drop the staging table after each flush, and to drop a table before a backfill.
"s3tables:DeleteTable",
"s3tables:GetTableBucket",
"s3tables:GetTableMetadataLocation",
"s3tables:ListTables",
"s3tables:GetNamespace",
"s3tables:ListNamespaces",
// CreateNamespace is only required if you want Artie to create missing namespaces when the pipeline deploys.
"s3tables:CreateNamespace"
],
Resource = [
"arn:aws:s3tables:*:*:bucket/${var.table_bucket_name}",
"arn:aws:s3tables:*:*:bucket/${var.table_bucket_name}/*"
]
},
{
Effect = "Allow",
Action = [
"s3tables:GetTable",
"s3tables:GetTableData",
"s3tables:GetTableMetadataLocation",
"s3tables:PutTableData",
"s3tables:UpdateTableMetadataLocation"
],
Resource = [
"arn:aws:s3tables:*:*:bucket/${var.table_bucket_name}/table/*"
]
},
// If the S3 Tables bucket is encrypted with KMS:
{
Effect = "Allow",
Action = [
"kms:GenerateDataKey",
"kms:Decrypt",
],
Resource = [
"arn:aws:kms:${var.region}:${var.account_id}:key/${var.kms_key_id}",
]
}
]
})
}
resource "aws_iam_user" "s3_tables_user" {
name = var.service_account_name
path = "/"
}
resource "aws_iam_user_policy_attachment" "s3_tables_user_policy_attachment" {
user = aws_iam_user.s3_tables_user.name
policy_arn = aws_iam_policy.s3_tables_policy.arn
}
resource "aws_iam_access_key" "s3_tables_user_key" {
user = aws_iam_user.s3_tables_user.name
}
output "aws_access_key_id" {
value = aws_iam_access_key.s3_tables_user_key.id
sensitive = true
}
output "aws_secret_access_key" {
value = aws_iam_access_key.s3_tables_user_key.secret
sensitive = true
}Set table_bucket_name to the name of your table bucket and service_account_name to the name of the new IAM user.
If the table bucket is encrypted with KMS, set kms_key_id, region and account_id to the key’s ID, Region and AWS account ID. If it isn’t, remove those three variables and the KMS statement.
The script marks both outputs as sensitive. Enter aws_access_key_id in AWS access key ID and aws_secret_access_key in AWS secret access key.
Add S3 Tables to a pipeline
When you create a pipeline, the Destination section of the setup has these steps.
Choose the destination
In Choose destination, select Iceberg.
Enter the connection details
In Connect and verify, set Catalog type to AWS S3 Tables. Then enter AWS access key ID, AWS secret access key, AWS Region and Table bucket ARN.
Under Table bucket ARN, Where do I find this? opens a picture of the ARN in the AWS console.
Choose the namespace
In Namespace name, select the namespace Artie writes to.
To create a namespace, type its name and select Create “NAME”, where
NAMEis the name you typed. This needs thes3tables:CreateNamespacepermission.When your source has schemas, a Namespace control offers One namespace and Multiple namespaces. Multiple namespaces writes each table to a namespace named after its source schema. Namespace name prefix (optional) adds a prefix to each one.
Verify the destination
Select Verify destination. Artie shows “Destination verified”.
If the pipeline has no tables yet, the button reads Test connection. A passing test shows “Connection works. Choose tables to finish verifying the destination.”
The setup has no Network access or Prepare destination step for Iceberg. Run the service account script before you reach Connect and verify.
Dynamically create namespaces is on for a pipeline created in the setup. With it on, Artie creates namespaces that don’t exist, which needs the s3tables:CreateNamespace permission.
To change these settings on an existing pipeline, select Edit pipeline, then open the Destination: Iceberg tab. Namespace name is locked while the pipeline is running. Pause the pipeline to change it, then move its tables to the new namespace in S3 Tables.
Naming rules
S3 Tables only accepts certain table and namespace names. When you verify the destination or deploy the pipeline, Artie checks every destination table name, history table name and namespace against these rules. A name that breaks one stops the check with an error that names it.
| Rule | Applies to | Error |
|---|---|---|
| Lowercase letters, numbers and underscores only | Tables and namespaces | table name "<name>" has a character S3 Tables doesn't allow; S3 Tables only allows lowercase letters, numbers, and underscores |
| Starts with a letter or number | Tables and namespaces | table name "<name>" must start with a letter or number |
| 255 bytes or fewer | Tables and namespaces | table name "<name>" exceeds maximum length of 255 bytes |
| Ends with a letter or number | Namespaces | namespace "<name>" must end with a letter or number |
Doesn’t start with aws | Namespaces | namespace "<name>" can't start with "aws" |
Namespace errors start with namespace instead of table name. Artie lowercases namespaces before it checks them, so a source schema named Sales passes as sales.
A history table’s name is the destination table name plus __history, and the 255-byte limit applies to the full name. AWS lists the rules in S3 Tables naming rules.
Fix a table name error
In the setup, open the table in Choose tables, expand Advanced options, then set a valid Name in destination.
On an existing pipeline, open the table’s Advanced settings. Select Use different table name in destination, then set a valid Destination table name and validate again.
Fix a namespace error
Change Namespace name in the pipeline’s destination settings. With Multiple namespaces, each namespace is the prefix plus the source schema name. Change Namespace name prefix (optional), or switch to One namespace.
Table format
S3 Tables pipelines create Iceberg v2 tables. The Table format setting stays on Iceberg v2, since Athena and StarRocks can’t read v3 tables yet.
A pipeline saved with v3 stops the check with this error:
S3 Tables only supports Iceberg v2 tables, since Athena and StarRocks can't read v3. Set the table format to v2Switch Table format to Iceberg v2 and deploy again.
Iceberg v3 is only selectable with a REST catalog.
Was this page helpful?
- Need help? Message us on Slack or email [email protected].
- Want a walkthrough? Book a demo.
- LLM? Read llms.txt.