CreateTableCommand

Creates a new table associated with the given namespace in a table bucket. For more information, see Creating an Amazon S3 table  in the Amazon Simple Storage Service User Guide.

Permissions
  • You must have the s3tables:CreateTable permission to use this operation.

  • If you use this operation with the optional metadata request parameter you must have the s3tables:PutTableData permission.

  • If you use this operation with the optional encryptionConfiguration request parameter you must have the s3tables:PutTableEncryption permission.

Additionally,

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { S3TablesClient, CreateTableCommand } from "@aws-sdk/client-s3tables"; // ES Modules import
// const { S3TablesClient, CreateTableCommand } = require("@aws-sdk/client-s3tables"); // CommonJS import
const client = new S3TablesClient(config);
const input = { // CreateTableRequest
  tableBucketARN: "STRING_VALUE", // required
  namespace: "STRING_VALUE", // required
  name: "STRING_VALUE", // required
  format: "ICEBERG", // required
  metadata: { // TableMetadata Union: only one key present
    iceberg: { // IcebergMetadata
      schema: { // IcebergSchema
        fields: [ // SchemaFieldList // required
          { // SchemaField
            name: "STRING_VALUE", // required
            type: "STRING_VALUE", // required
            required: true || false,
          },
        ],
      },
    },
  },
  encryptionConfiguration: { // EncryptionConfiguration
    sseAlgorithm: "AES256" || "aws:kms", // required
    kmsKeyArn: "STRING_VALUE",
  },
};
const command = new CreateTableCommand(input);
const response = await client.send(command);
// { // CreateTableResponse
//   tableARN: "STRING_VALUE", // required
//   versionToken: "STRING_VALUE", // required
// };

CreateTableCommand Input

See CreateTableCommandInput for more details

Parameter
Type
Description
format
Required
OpenTableFormat | undefined

The format for the table.

name
Required
string | undefined

The name for the table.

namespace
Required
string | undefined

The namespace to associated with the table.

tableBucketARN
Required
string | undefined

The Amazon Resource Name (ARN) of the table bucket to create the table in.

encryptionConfiguration
EncryptionConfiguration | undefined

The encryption configuration to use for the table. This configuration specifies the encryption algorithm and, if using SSE-KMS, the KMS key to use for encrypting the table.

If you choose SSE-KMS encryption you must grant the S3 Tables maintenance principal access to your KMS key. For more information, see Permissions requirements for S3 Tables SSE-KMS encryption .

metadata
TableMetadata | undefined

The metadata for the table.

CreateTableCommand Output

See CreateTableCommandOutput for details

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
tableARN
Required
string | undefined

The Amazon Resource Name (ARN) of the table.

versionToken
Required
string | undefined

The version token of the table.

Throws

Name
Fault
Details
BadRequestException
client

The request is invalid or malformed.

ConflictException
client

The request failed because there is a conflict with a previous write. You can retry the request.

ForbiddenException
client

The caller isn't authorized to make the request.

InternalServerErrorException
server

The request failed due to an internal server error.

NotFoundException
client

The request was rejected because the specified resource could not be found.

TooManyRequestsException
client

The limit on the number of requests per second was exceeded.

S3TablesServiceException
Base exception class for all service exceptions from S3Tables service.