Alternator is an open-source project that gives Scylla compatibility with Amazon DynamoDB.
This lab starts with an introduction to the project. Afterward, you’ll create a one-node Scylla cluster with Alternator enabled, and performing some basic operations on it, using Python.
The goal of Alternator is to deliver an open-source alternative to DynamoDB, deployable wherever a user would want: on-premises, on other public clouds like Microsoft Azure or Google Cloud Platform, or still on AWS (for users who wish to take advantage of other aspects of Amazon’s market-leading cloud ecosystem, such as the high-density i3en instances). DynamoDB users can keep their same client code unchanged. Alternator is written in C++ and is a part of Scylla.
The three main benefits Scylla Alternator provides to DynamoDB users are:
- Cost: DynamoDB charges for read and write transactions (RCUs and WCUs). A free, open-source solution doesn’t.
- Performance: Scylla was implemented in modern C++. It supports advanced features that enable it to improve latency and throughput significantly.
- Openness: Scylla is open-source. It can run on any suitable server cluster regardless of location or deployment method.
This lab is part of Scylla University.
Congratulations! You have completed the Project Alternator: Getting Started Lab.
- Project Alternator Wiki, with examples (Github)
- Scylla Cloud versus Amazon DynamoDB, benchmark
- Alternator Design Documentation
- Project Alternator course on Scylla University.
- Alternator uses Scylla’s LWT feature. You can read more about this in the documentation.
In this lesson, you learned the basics of Alternator: the open-source DynamoDB Scylla API. You saw how to create a cluster, connect to it, write data, and read data. Future lessons will cover more advanced topics and more interesting examples, including data modeling, backup and restore, single region vs. multi-region, streams (CDC), encryption at rest, and more.
ScyllaDB: Project Alternator: Getting Started Lab
Install and Setup a Cluster
In production, a Scylla cluster should have at least three nodes in a cluster. In this lab, just for the demonstration, you will start by creating a single node cluster with Alternator enabled.
Create a Scylla Cluster
If you haven’t done so yet, download the example from git:
git clone https://github.com/scylladb/scylla-code-samples.git
Go to the directory of the alternator example:
Start a one-node cluster with Alternator enabled.
By default, Scylla does not listen to DynamoDB API requests. To enable such requests, set the alternator-port configuration option to the port (8000 in this example), which will listen for DynamoDB API requests.
docker run --name some-scylla --hostname some-scylla -p 8000:8000 -d scylladb/scylla:4.4.0 --smp 1 --overprovisioned 1 --alternator-port=8000 --alternator-write-isolation=always
Wait a few seconds and make sure the cluster is up and running:
docker exec -it some-scylla nodetool status
Next, if you don’t already have it set up, install boto3 python library, which also contains drivers for DynamoDB:
sudo pip install --upgrade boto3
In the three scripts create.py read.py and write.py change the value for “endpoint_url” to the IP address of the node. Copy the IP address from the output of the previously used "nodetool status" command, then edit the three files and replace the IP address: