Search⌘ K
AI Features

Introduction to Amazon Keyspaces

Explore Amazon Keyspaces, a fully managed, serverless Apache Cassandra-compatible database service. Understand its wide-column data model, primary key design, and CQL-based CRUD operations. Learn how to connect applications securely using Cassandra drivers with AWS authentication. Gain insights into query constraints driven by primary-key structure to ensure efficient and predictable performance.

Amazon Keyspaces occupies a specific niche in the AWS database portfolio. It delivers a fully managed, serverless, Apache Cassandra-compatible wide-column database that lets organizations run Cassandra workloads without provisioning servers, patching software, managing compaction, or configuring replication. Many teams already rely on CQL and Cassandra drivers in production, and Keyspaces removes the undifferentiated operational burden while preserving that application-level compatibility. Within the broader AWS ecosystem, the natural comparison is DynamoDB. Both are NoSQL, both scale horizontally, and both replicate across multiple Availability Zones automatically. The deciding factor is the workload's interface requirements. When a scenario explicitly calls for CQL compatibility, Cassandra driver support, and the wide-column data model, Keyspaces is the correct service. DynamoDB uses its own API and data model, so migrating an existing Cassandra application to DynamoDB would require rewriting queries and driver code. Keyspaces supports on-demand and provisioned capacity modes for serverless scaling, encrypts data at rest by default using AWS-owned keys or customer-managed KMS keys, and offers point-in-time recovery for backup and restore within a 35-day window. All of these features operate without cluster management. Before writing a single query or connecting an application, you must understand how the Cassandra data model and primary-key structure govern every aspect of query behavior. That understanding is the focus of this lesson.

The Cassandra data model in Keyspaces

Data in Amazon Keyspaces follows a strict hierarchy. A keyspaceThe top-level namespace in Cassandra-style databases, analogous to a schema or database in relational systems, used to group related tables under a single logical container. sits at the top and groups related tables. Each table holds rows, and every row is identified by a primary key. Unlike relational databases, Keyspaces tables are schema-flexible for non-key columns, meaning one row can carry columns that another row in the same table does not have. This is the essence of the wide-column model, where a single partition can store many related rows, each with a potentially different set of value columns.

Primary key anatomy

The PRIMARY KEYA composite declaration in CQL that combines one or more partition-key columns with zero or more clustering columns to uniquely identify each row and control data distribution and sort order. is the most consequential design decision in any Keyspaces table. It consists of two parts.

  • Partition key: One or more columns whose combined hash value determines which logical partition a row belongs to. Rows sharing the same partition key are stored together, enabling efficient retrieval of related data in a ...