Creating an Amazon S3 table
An S3 table is a subresource of a table bucket. This resource stores tables in the
Apache Iceberg
format so you can work with them using query
engines and other applications that support Iceberg. As a prerequisite to working with
tables, you need to create a table bucket.
Before creating a table, you must have a namespace for the table to belong to. To create a
namespace for the table, see Create a namespace.
When you create a table, Amazon S3 automatically generates a warehouse location for the table. This is a unique S3 location where you can read and write objects associated with the table. The following example shows the format of a warehouse location:
s3://63a8e430-6e0b-46f5-k833abtwr6s8tmtsycedn8s4yc3xhuse1b--table-s3
Tables have the following Amazon Resource Name (ARN) format:
arn:aws:s3tables:
Region
:OwnerAccountID
:bucket/bucket-name
/table/tableID
By default, you can create up to 100 tables in a table bucket. To request a quota
increase for Table buckets or tables, contact AWS Support
You can create a table by using the Amazon S3 REST API, AWS SDK, AWS CLI, or integrated query engines.
For information on valid table names, see Naming rules for tables and namespaces.
This example shows you how to create a table by using the AWS CLI. To use this example,
replace the user input placeholders
with your own
information.
aws s3tables create-table \ --table-bucket-arn arn:aws:s3tables:
us-east-1
:111122223333
:bucket/amzn-s3-demo-table-bucket \ --namespaceyour_namespace
\ --nameexample_table
--format ICEBERG
You can create a table in an Apache Spark
session
connected to your Amazon S3 table buckets. You can use tables with
Spark
through Amazon EMR or the Amazon S3 Tables Catalog for Apache Iceberg.
This example shows you how to create a table by using CREATE
statements
in a query engine integrated with S3 Tables. To use this example, replace the
user input placeholders
with your own
information.
spark.sql( " CREATE TABLE IF NOT EXISTS s3tablesbucket.
example_namespace
.`example_table
` ( id INT, name STRING, value INT ) USING iceberg " )