Amazon Keyspaces

Learn about the Amazon Keyspaces (for Apache Cassandra), its capacity modes, and backup and restore options.

Amazon Keyspaces (for Apache Cassandra) is an open-source, NoSQL, scalable, highly available, and fully managed database service. It is a serverless service that saves us from managing and maintaining clusters manually. Keyspaces is used for applications that require fast performance and scalability. It automatically scales up and down the table size per the application’s need.

Press + to interact

Since it is compatible with Apache Cassandra, it uses Cassandra Query Language (CQL) and Cassandra drivers, tools, and APIs to run our existing Cassandra applications on AWS. It replicates the table data 3 times in different AWS Availability Zones to achieve high availability. It helps achieve single-digit millisecond latency irrespective of the size of the database, with 99.99% availability. 

Use cases for Amazon Keyspaces

Amazon Keyspaces is designed to handle low-latency, mission-critical applications requiring single-digit milliseconds latency. A few of the use cases for Amazon Keyspaces include:

  • Migrating Cassandra tables to the cloud to get rid of management and maintenance tasks.

  • Building applications like fleet management and route optimization that require low latency.

  • Building applications using open-source Cassandra APIs and drivers available for a wide range of programming languages.

Serverless resources management

Amazon Keyspaces (for Apache Cassandra) is a serverless service which means that we don’t need to provision any computing resources and manage software installations or updations. It allocates storage and throughput resources directly to the tables; therefore, it can automatically scale up and down with the table’s workloads.

Press + to interact
High level structure of Keyspaces table
High level structure of Keyspaces table

Amazon Keyspaces has two read/write throughput capacity modes in tables. These capacity modes define the requests per second that can be made on our table, and we are charged according to the capacity. 

  • On-demand capacity mode: This is a flexible capacity mode that increases or decreases according to the workload. In this mode, we don’t need to specify the capacity because Amazon Keyspaces monitors our application’s load and instantly increases/decreases the capacity, and we are charged only for the read request units (RRUs) and write request units (WRUs). This option is good to go with when we are unsure about the application’s traffic and want to pay only for what we use. 

  • Provisioned capacity mode: We define the number of requests we want to achieve per second and optimize the price according to our predicted traffic. This mode is good when we know the application’s traffic load and want to achieve a certain throughput every time. 

Multi-Region Replication

Amazon Keyspaces supports Multi-Region Replication, a fully managed, automated, and active-active replication facility that lets us replicate data across 6 different AWS Regions of our choice. Active-active replication allows read and write operations with single-digit milliseconds latency on tables available in that region. Finally, the new data is replicated to the other tables in other AWS Regions. 

Note: Amazon Keyspaces is highly available in one AWS Region by default.

Benefits of Multi-Region Replication

The following are the benefits of using Multi-Region Replication:

  • Global reads and writes to the local AWS Region allow to achieve single-digit milliseconds latency at any scale.

  • Having data available in different AWS Regions makes the Amazon Keyspaces highly available and fault tolerant. In the event of any AWS Region failure, the requests can be routed to the other nearest region. If failure happens during the write operations, the data that is not yet replicated to other regions is kept by Amazon Keyspaces, and once the faulty regions come back online, the data is replicated to other regions.

  • Data is eventually consistent across the AWS Regions. Because of the active-active replication, data can be written to all tables in any AWS Region; therefore, there are high chances of data conflicts. Amazon Keyspaces uses the last-writer wins approach to resolve the conflict and preserve consistency.

Press + to interact
High level view of Multi-Region Replication in Keyspaces
High level view of Multi-Region Replication in Keyspaces

Backup and restore

Amazon Keyspaces allows us to create a continuous backup using point-in-time recovery (PITR) with a per-second granularity level. This means we can restore our data to any second in time within a retention period of 35 days.

Get hands-on with 1300+ tech skills courses.