Setting up PutRows
Before you write rows with PutRows, make sure that you have the required resources and permissions.
Required resources
-
Table bucket – The table bucket that contains the table. The table bucket can use server-side encryption with Amazon S3 managed keys (SSE-S3) or with AWS Key Management Service (AWS KMS) keys (SSE-KMS).
-
Namespace and table – An Apache Iceberg table with a defined schema. PutRows validates rows against this schema, so define the table's columns when you create the table. A request to a table without a schema fails.
Required permissions
The IAM identity that calls PutRows needs the following permissions on the table:
-
s3tables:PutTableData– Write the rows. -
s3tables:GetTableData– Read the table's data and metadata. -
s3tables:GetTableMetadataLocationands3tables:UpdateTableMetadataLocation– Commit the rows to the table. -
s3tables:GetChannel– Check the state of the table's channel. This permission is required only to callGetChannel.
The following example policy grants these permissions on every table in a table bucket. To limit access to a single table, replace table/* with the table ID. To use this example, replace the placeholders with your own information.
{ "Version": "2012-10-17", "Statement": [ { "Sid": "AllowPutRows", "Effect": "Allow", "Action": [ "s3tables:PutTableData", "s3tables:GetTableData", "s3tables:GetTableMetadataLocation", "s3tables:UpdateTableMetadataLocation", "s3tables:GetChannel" ], "Resource": "arn:aws:s3tables:us-east-1:111122223333:bucket/amzn-s3-demo-table-bucket/table/*" } ] }
Permissions for tables encrypted with SSE-KMS
If the table uses server-side encryption with AWS KMS keys (SSE-KMS), the PutRows service principal (putrows.s3tables.amazonaws.com) needs kms:GenerateDataKey and kms:Decrypt permissions on the table's KMS key, so that S3 Tables can write and commit your rows.
The following example key policy statement grants the PutRows service principal permission to use a KMS key for a table. The condition limits the key's use to the table that you specify by its ARN. Add this statement to your existing key policy. To use this example, replace the placeholders with your own information.
{ "Sid": "AllowPutRowsKeyUsage", "Effect": "Allow", "Principal": { "Service": "putrows.s3tables.amazonaws.com" }, "Action": [ "kms:GenerateDataKey", "kms:Decrypt" ], "Resource": "arn:aws:kms:us-east-1:111122223333:key/key-id", "Condition": { "StringEquals": { "kms:EncryptionContext:aws:s3:arn": "arn:aws:s3tables:us-east-1:111122223333:bucket/amzn-s3-demo-table-bucket/table/table-id" } } }
For more information about key policies for S3 Tables, see Permission requirements for S3 Tables SSE-KMS encryption.
Considerations and limitations
-
PutRows appends rows. To update or delete rows, use an Iceberg engine such as Amazon Athena or Apache Spark.
-
PutRows provides at-least-once delivery and doesn't deduplicate retried requests. For more information, see Errors and retries.
-
PutRows supports payloads in newline-delimited JSON and Avro object container files (OCF). Each Avro payload must include its writer schema. PutRows doesn't support schema-less Avro, such as records that rely on a separate schema registry.
-
PutRows doesn't support Avro unions other than a union of null and one other type, or Avro single-object encoding, the Confluent wire format, or multiple concatenated files. For the data types that PutRows supports in each format and other payload limitations, see Payload formats.
-
PutRows doesn't support Apache Iceberg format version 1 tables. Use version 2 or 3.
-
PutRows doesn't support tables that use Iceberg table encryption.
-
Partitioning value limitations
-
PutRows doesn't support tables that use identity partitions on float or double columns, or partitions on columns of type
unknown. -
PutRows rejects a row whose
truncatepartition on a decimal rounds past the column's precision. -
PutRows limits a row's partition value to at most 1,024 characters (stringified according to the iceberg spec, e.g. with binary and fixed values as hex).
-
-
PutRows supports table metadata files (
metadata.json) up to 45 MB. To keep the metadata file below this size, turn on snapshot management so that S3 Tables expire old snapshots, and periodically rewrite the table's manifests with an Iceberg engine, for example with the Apache Sparkrewrite_manifestsprocedure. S3 Tables maintenance doesn't rewrite manifests. -
PutRows rejects every request to a table with a field deeper than 32 levels down. (Top level fields are at level 1.)
-
PutRows supports schema changes that follow Apache Iceberg schema evolution rules, such as adding an optional column. For guidance, see Best practices, monitoring, and troubleshooting PutRows.
-
While a table has accepted rows that aren't committed yet, S3 Tables block all schema changes on the table. S3 Tables also block other changes that could keep those rows from being committed, including commits that other writers make through
UpdateTableMetadataLocation, table format upgrades, and other table updates through the Iceberg REST endpoint. If a change is blocked, wait for the buffered rows to be committed, and then try again. -
PutRows supports one channel per table.
-
For PutRows request size, partition, request rate, throughput, and schema size quotas, see S3 Tables PutRows quotas.
-
PutRows is available in the following AWS Regions: US East (N. Virginia), US East (Ohio), US West (N. California), US West (Oregon), Asia Pacific (Hyderabad), Asia Pacific (Malaysia), Asia Pacific (Mumbai), Asia Pacific (Osaka), Asia Pacific (Seoul), Asia Pacific (Singapore), Asia Pacific (Sydney), Asia Pacific (Tokyo), Canada (Central), Europe (Frankfurt), Europe (Ireland), Europe (London), Europe (Paris), Europe (Spain), Europe (Stockholm), and South America (São Paulo).