Running an Apache Cassandra-Compatible Database with Amazon Keyspaces - Getting Started with Serverless Globally Distributed DB
Run an Apache Cassandra-compatible wide-column database in a serverless model. This article covers capacity selection between on-demand and provisioned modes, and partition key design.
Keyspaces Features and Differences from Cassandra
Keyspaces is a managed database service compatible with Apache Cassandra. You use CQL to create tables and read/write data, and can use existing Cassandra drivers (such as the DataStax Java Driver) as-is. It eliminates the need for node management, patch application, repair processing, and compaction tuning required when operating a Cassandra cluster. However, not all Cassandra features are supported - some Lightweight Transactions (LWT), user-defined functions, and materialized views are unsupported. Before migration, you need to check the compatibility matrix and verify that the CQL features your application uses are supported.
Capacity Modes and Partition Design
On-demand mode auto-scales based on request volume, requiring no upfront capacity planning. It is well suited for unpredictable traffic patterns and development/test environments. Provisioned mode lets you specify read/write capacity units in advance, with Auto Scaling for automatic adjustment. For production environments with stable traffic, provisioned mode offers better cost efficiency. Partition key design is just as critical as in Cassandra - choose keys with high cardinality that distribute access evenly. Hot partitions cause throttling, so for time-series data, combine a bucket ID with the timestamp rather than using the timestamp alone.
Security and Backup
Keyspaces has at-rest encryption enabled by default, with a choice of AWS managed keys or customer managed keys (KMS). Data in transit is encrypted with TLS. Access control is managed through IAM policies, with fine-grained permissions at the table level. Enabling point-in-time recovery (PITR) lets you restore a table to any second within the past 35 days. This is effective for recovering from accidental data deletion or data corruption caused by application bugs. PITR incurs additional charges, but enabling it is strongly recommended for production environments. For a thorough study of Keyspaces data modeling, refer to technical books (Amazon).
Keyspaces Pricing
On-demand mode costs approximately $0.297 per million read units and approximately $1.4846 per million write units. Provisioned mode costs approximately $0.000742 per read capacity unit (RCU) per month and approximately $0.000371 per write capacity unit (WCU) per month. Compared to DynamoDB, the pricing structure is nearly identical, but Keyspaces offers the advantage of lower migration costs (application changes) for existing Cassandra workloads since it uses CQL for access. Storage costs approximately $0.25 per GB per month, with additional storage charges when PITR is enabled.
Summary
Keyspaces is a serverless database accessible via Cassandra-compatible CQL. It eliminates cluster management overhead and charges only for what you use with on-demand capacity. It is effective for migrating existing Cassandra workloads to AWS or building new workloads where the Cassandra data model is a good fit.