Create a namespace - Amazon Simple Storage Service

Create a namespace

A table namespace is a logical construct that you group tables under. Each table belongs to a single namespace. Before creating a table, you must create a namespace to group tables under. You can create a namespace by using the Amazon S3 REST API, AWS SDK, AWS CLI, or integrated query engines.

Namespace names

The following naming rules apply to namespaces:

  • Names must be between 3 (min) and 63 (max) characters long.

  • Names can consist only of lowercase letters, numbers, and underscores (_).

  • Names must begin and end with a letter or number.

  • Names must not contain hyphens (-) or periods (.).

For information on valid namespace names, see Naming rules for tables and namespaces.

This example shows how to create a table namespace by using the AWS CLI. To use this example, replace the user input placeholders with your own information.

aws s3tables create-namespace \ --table-bucket-arn arn:aws:s3tables:us-east-1:111122223333:bucket/amzn-s3-demo-bucket1 \ --namespace example_namespace

You can create a namespace 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 NAMESPACE IF NOT EXISTS s3tablesbucket.my_namespace")