Apache Cassandra
Overview
This guide shows how to deploy and configure Apache Cassandra on Linux from a SecureAnyCloud AMI on AWS Marketplace. Apache Cassandra is a highly scalable, distributed NoSQL database that handles large volumes of data across multiple servers with no single point of failure.
What you get:
- Apache Cassandra 4.0.4 with CQL native transport on port 9042
- Java runtime environment
- Dedicated data volume at /var/lib/cassandra
- Systemd service for automatic startup on boot
- OS package update script for keeping the system current
- AWS CLI v2 for AWS service integration
- Systems Manager Agent (SSM) for remote management
- CloudWatch Agent for monitoring
- Latest security patches applied at build time
- 24/7 SecureAnyCloud support with guaranteed 24 hour response SLA
Prerequisites
Before you launch this AMI, make sure you have:
- An active AWS account
- An active subscription to the Apache Cassandra listing on AWS Marketplace
- An EC2 key pair for SSH access
- Familiarity with EC2 instance management and SSH
Recommended instance type: m5.large (2 vCPU, 8 GB RAM) or larger. The minimum requirements are 1 vCPU, 1 GB RAM and 20 GB of disk space. Cassandra benefits significantly from more memory and CPU for production workloads.
Launch the AMI
- Open AWS Marketplace and search for "Apache Cassandra SecureAnyCloud".
- Choose Continue to Subscribe, accept the terms, then choose Continue to Configuration.
- Choose your Region and Software Version.
- Choose Continue to Launch.
- Choose Launch through EC2 for full control over instance configuration.
- Choose your instance type (
m5.largeis recommended).
- Configure storage: 20 GB gp3 minimum for the root volume. Use larger volumes for production data.
- Configure your Security Group with these inbound rules:
Port Protocol Source Purpose
22 TCP Your IP SSH access
7199 TCP Your IP JMX monitoring port
7000 TCP VPC only Internode communication
9042 TCP Your IP CQL native transport port
Important: Allow ports 7000 and 7199 only within your VPC, for cluster communication and monitoring. Restrict port 9042 to trusted application servers or your IP address.
- Choose your EC2 key pair and launch the instance.
Connect via SSH
When your instance is running and has passed both status checks (2/2), connect over SSH:
ssh -i your-key.pem ec2-user@<public-ip-address>To switch to the root user:
sudo su -Important: Wait until the instance reaches 2/2 successful status checks before you connect. Early connection attempts can fail with permission denied errors.
Verify that Cassandra is running
Check the status of the Cassandra node:
nodetool statusExpected output:
Datacenter: datacenter1 ======================== Status=Up/Down |/ State=Normal/Leaving/Joining/Moving -- Address Load Tokens Owns (effective) Host ID Rack UN 127.0.0.1 69.05 KiB 16 100.0% bb9d3091-c1e0-4ed2-92b4-2897099aba7d rack1The UN status indicates the node is Up and in a Normal state.
Connect with the CQL shell
Start the interactive CQL shell:
cqlshExpected output:
Connected to Test Cluster at 127.0.0.1:9042 [cqlsh 6.0.0 | Cassandra 4.0.4 | CQL spec 3.4.5 | Native protocol v5] Use HELP for help. cqlsh>Create a keyspace and table
Create a keyspace:
CREATE KEYSPACE my_app WITH replication = { 'class': 'SimpleStrategy', 'replication_factor': 1 };Use the keyspace:
USE my_app;Create a table:
CREATE TABLE users ( user_id UUID PRIMARY KEY, name text, email text, created_at timestamp );Insert data:
INSERT INTO users (user_id, name, email, created_at) VALUES (uuid(), 'John Doe', 'john@example.com', toTimestamp(now()));Query data:
SELECT * FROM users;Type EXIT to leave the CQL shell.
Server Components
Component Install Path
Apache Cassandra /etc/cassandra
Java /bin/java
Note: The automatic OS package update script can update component versions on first boot.
Filesystem Layout
Mount Point Size Description
/ 38 GB Root filesystem
/boot 2 GB Operating system kernel files
/var/lib/cassandra 9.8 GB Apache Cassandra data directory
Key Cassandra directories:
Directory Purpose
/etc/cassandra Configuration files
/etc/cassandra/cassandra.yaml Main configuration file
/var/lib/cassandra Data, commitlog, and saved caches
/var/lib/cassandra/data SSTable data files
/var/lib/cassandra/commitlog Write ahead log
/var/log/cassandra Cassandra log files
Managing the Cassandra Service
Systemd manages Cassandra, and the service starts automatically on boot.
Check service status:
systemctl status cassandraStop Cassandra:
systemctl stop cassandraStart Cassandra:
systemctl start cassandraRestart Cassandra:
systemctl restart cassandraCheck node status with nodetool:
nodetool status nodetool info nodetool describeclusterScripts and Log Files
Script/Log Path Description
initial_boot_update.sh /stage/scripts Updates the OS with the latest packages on first boot
initial_boot_update.log /stage/scripts Output log for the boot update script
On Startup
An OS package update script runs on first boot to bring the image fully up to date. To disable it, remove the script and its crontab entry:
rm -f /stage/scripts/initial_boot_update.sh crontab -e
# Delete the following line, save and exit: @reboot /stage/scripts/initial_boot_update.shTroubleshooting
Cassandra fails to start
- Check service status:
systemctl status cassandra
- Review logs:
tail -f /var/log/cassandra/system.log
- Verify disk space:
df -h /var/lib/cassandra
- Check JVM heap settings in
/etc/cassandra/cassandra-env.sh
nodetool status shows DN (Down/Normal)
- Restart Cassandra:
systemctl restart cassandra
- Check for errors in
/var/log/cassandra/system.log
- Verify JMX port 7199 is not blocked
CQL connection refused on port 9042
- Verify Cassandra is running:
systemctl status cassandra
- Check that
native_transport_portis set to 9042 incassandra.yaml
- Verify the security group allows port 9042
High memory usage
- Cassandra uses significant heap memory by design.
- Adjust the heap size in
/etc/cassandra/cassandra-env.sh.
- Consider moving to a memory-optimized instance type (r5, r6i).
Security Recommendations
- Restrict port access: Only allow CQL port 9042 from trusted application servers
- Enable authentication: Configure
authenticator: PasswordAuthenticatorin cassandra.yaml
- Enable authorization: Configure
authorizer: CassandraAuthorizerin cassandra.yaml
- Encrypt client connections: Enable SSL/TLS for client to node communication
- Encrypt cluster communication: Enable internode encryption for port 7000
- Change default credentials: If authentication is enabled, create new users and remove the default
cassandrauser
- Keep Cassandra updated: Apply security patches when available
- Monitor with JMX: Use nodetool and JMX for monitoring cluster health
Support
If you have a problem with this product, contact SecureAnyCloud support:
- Email: sales@secureanycloud.com
- Website: secureanycloud.com
- Support hours: 24/7 with guaranteed 24 hour response SLA
Deploy on AWS
Launch Apache Cassandra with 24/7 support from SecureAnyCloud.
View on Marketplace
Need Help?
Our support team is available 24/7.
sales@secureanycloud.com
Deploy on AWS
Launch Apache Cassandra with 24/7 support from SecureAnyCloud.
View on Marketplace
Need Help?
Our support team is available 24/7.
sales@secureanycloud.com
Overview
This image runs Apache Cassandra, the open source distributed NoSQL database built for scalability and high availability with no single point of failure. Cassandra is the only workload on the image, so the platform stays lean and predictable. The image provides the current stable line, version 5.0, installed from the official Apache Cassandra package repository.
The image is headless. Cassandra has no web interface, so you administer it over SSH with the cqlsh CQL shell and the nodetool cluster utility, both covered below.
What you get:
- Password authentication and authorization switched on. The Cassandra configuration sets the
PasswordAuthenticator, theCassandraAuthorizerand theCassandraRoleManager, so access to the database is controlled from the moment the node starts. - A unique superuser password per instance. On first boot, a one-shot service generates a fresh, strong password for the
cassandrasuperuser, applies it to the database and writes it to/root/cassandra-credentials.txt, a file that only the root user can read. No shared or default database credentials ship in the image. - A dedicated storage volume mounted at
/var/lib/cassandrafor Cassandra data, the commit log and saved caches. Because the database files are on their own volume, you can grow, snapshot and back up storage independently of the operating system disk. - A single-node cluster by default. The final section of this guide explains how to add further nodes.
Prerequisites
Before you deploy this image, make sure you have:
- An Amazon Web Services account where you can launch EC2 instances
- IAM permissions to launch instances, create security groups, and subscribe to AWS Marketplace products
- An EC2 key pair in the target Region for SSH access to the instance
- A VPC and subnet in the target Region, with a security group allowing inbound port 22 from your management network
- The AWS CLI (version 2) installed locally if you plan to deploy from the command line
Recommended instance type: m5.large (2 vCPU, 8 GB RAM) or larger. Cassandra sizes its JVM heap from available memory. It benefits from more CPU and RAM for production workloads.
Launch the instance from AWS Marketplace
Sign in to the AWS Management Console, open the EC2 service and choose Launch instance. Under Application and OS Images, choose AWS Marketplace AMIs and search for Apache Cassandra. Choose Select on the SecureAnyCloud listing, then choose Continue on the subscription summary.
Choose an instance type of m5.large or larger. Choose your EC2 key pair under Key pair (login). Under Network settings, choose your VPC and subnet, then create or choose a security group that allows inbound port 22 from your management network. Keep the root volume at the default size or larger. The Cassandra data volume is attached automatically from the image.
Choose Launch instance. First boot initialization generates the superuser password and starts Cassandra. It takes a minute or two after the instance state becomes Running and the status checks pass.
Launch the instance from the AWS CLI
The following command launches an instance from the SecureAnyCloud Apache Cassandra Marketplace AMI into an existing subnet and security group. Replace <ami-id> with the AMI ID shown on the Marketplace listing, <key-name> with your EC2 key pair name, <subnet-id> with your subnet ID, and <security-group-id> with a security group that opens inbound port 22.
aws ec2 run-instances \
--image-id <ami-id> \
--instance-type m5.large \
--key-name <key-name> \
--subnet-id <subnet-id> \
--security-group-ids <security-group-id> \
--metadata-options HttpTokens=required \
--block-device-mappings '[{"DeviceName":"/dev/sda1","Ebs":{"VolumeSize":30,"VolumeType":"gp3"}}]' \
--tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=cassandra-01}]'On success, the command prints a JSON document. Note the instance ID, then get the public address once the instance is running with aws ec2 describe-instances --instance-ids <instance-id> --query "Reservations[].Instances[].PublicIpAddress" --output text.
Connect over SSH
Connect over SSH with the key pair you chose and the public IP address from step 2. The SSH login user depends on the operating system of the AMI variant you launched:
AMI variant SSH login user
Apache Cassandra 5.0 on Ubuntu 24.04 ubuntu
ssh <login-user>@<public-ip>Wait until the instance has passed both EC2 status checks before you connect. The first boot service runs before the SSH daemon is ready, so Cassandra is initialized by the time you can log in.
Retrieve the generated superuser password
The first boot service generates a fresh cassandra superuser password for this instance. It writes the password, with the connection details, to /root/cassandra-credentials.txt, which only the root user can read. Display the file from your SSH session:
sudo cat /root/cassandra-credentials.txtThe file looks like this, with a unique password on your instance:
# Apache Cassandra 5.0 — Per-Instance Credentials
# Generated on first boot: Thu May 21 14:05:56 UTC 2026
#
# Open the CQL shell with:
# cqlsh-sac -u cassandra -p '<password below>'
# CASSANDRA_USER=cassandra CASSANDRA_PASSWORD=<your generated password> CQL_HOST=127.0.0.1 CQL_PORT=9042 CLUSTER_NAME=sac-cassandraThe default cassandra / cassandra account that ships with Apache Cassandra is rotated away during first boot, so it no longer works. Use the generated password for every connection.
Confirm the service and the listener
Cassandra runs under systemd as the cassandra service and starts automatically on boot. Confirm that it is active:
systemctl is-active cassandraThe command prints active. Next, confirm that the CQL native transport is listening. By default, Cassandra binds to the loopback address 127.0.0.1 on port 9042, so it is reachable from the instance itself:
ss -tln | grep 9042You should see a listening socket on 127.0.0.1:9042.
Connect with the cqlsh CQL shell
The image provides cqlsh-sac, a wrapper that starts the Cassandra CQL shell against the local node. Open an interactive session with the generated superuser password. Replace <password> with the value from /root/cassandra-credentials.txt:
cqlsh-sac -u cassandra -p '<password>'To run a single statement without entering the interactive shell, add -e. The screenshot below shows a complete session that reads the credentials file, opens cqlsh, creates a keyspace and a table, inserts two rows and reads them back.
To verify the connection non-interactively from your SSH session, query the server version. Replace <password> with your generated password:
cqlsh-sac -u cassandra -p '<password>' \
-e "SELECT cluster_name, release_version, cql_version FROM system.local;"The query returns the cluster name, the Cassandra release and the CQL specification version:
cluster_name | release_version | cql_version --------------------+-----------------+------------- sac-cassandra | 5.0.8 | 3.4.7 (1 rows)Create a keyspace and a table
A keyspace is the top-level container for data in Cassandra, and it defines the replication strategy. Run the following statements inside cqlsh to create a keyspace, switch to it, create a table, insert a row and query it. They mirror the session in the screenshot above.
CREATE KEYSPACE store WITH replication = { 'class': 'SimpleStrategy', 'replication_factor': 1 }; USE store; CREATE TABLE products ( id uuid PRIMARY KEY, name text, price decimal ); INSERT INTO products (id, name, price) VALUES (uuid(), 'Mechanical Keyboard', 89.00); SELECT name, price FROM products;For a single-node image, the SimpleStrategy class with a replication_factor of 1 is appropriate. When you add nodes, raise the replication factor and consider NetworkTopologyStrategy so that copies of the data are spread across the cluster. Type EXIT to leave the cqlsh shell.
Check node health with nodetool
nodetool is the cluster administration utility. nodetool status reports the state of every node. On this single-node image it lists one node, and the UN prefix means the node is Up and in a Normal state.
nodetool statusnodetool info reports detailed health for the local node. It shows the JVM heap in use, the uptime, the data load and whether gossip and the native transport are active.
nodetool infonodetool describecluster summarises the cluster as a whole, listing the snitch, the partitioner and the keyspaces with their replication settings:
nodetool describeclusterThe Cassandra data volume
Cassandra stores its data, the commit log and saved caches under /var/lib/cassandra, a dedicated EBS volume separate from the operating system disk. Confirm the mount:
findmnt /var/lib/cassandraThe output shows /var/lib/cassandra is its own ext4 filesystem on a separate device:
TARGET SOURCE FSTYPE OPTIONS /var/lib/cassandra /dev/nvme1n1 ext4 rw,relatimeBecause the data directory is on its own volume, you can take an Amazon EBS snapshot of it on its own schedule and grow it independently of the root volume. Check the available space at any time with:
df -h /var/lib/cassandraManaging the Cassandra service
Systemd manages Cassandra, and the service starts automatically on boot.
Check the service status:
systemctl status cassandra --no-pagerStop, start and restart the service when needed:
sudo systemctl stop cassandra
sudo systemctl start cassandra
sudo systemctl restart cassandraDrain a Cassandra node before you stop it. Draining flushes memtables to disk and stops the node accepting writes:
nodetool drainCassandra writes its log files under /var/log/cassandra. The main log is /var/log/cassandra/system.log. Read it first when you diagnose a startup or runtime problem:
sudo tail -f /var/log/cassandra/system.logBackups
Back up the contents of the data directory. nodetool snapshot creates a consistent, hard-linked snapshot of every keyspace:
nodetool snapshotCassandra writes the snapshot files under /var/lib/cassandra/data/<keyspace>/<table>/snapshots/. Archive them to durable storage, for example an Amazon S3 bucket:
sudo tar -czf /var/backups/cassandra-snapshot-$(date +%F).tgz -C /var/lib/cassandra/data .Because /var/lib/cassandra is a dedicated EBS volume, you can also take an EBS snapshot of the volume itself for a point-in-time copy of all Cassandra data. Remove a snapshot you no longer need with nodetool clearsnapshot.
Add nodes for a multi-node cluster
This image runs Cassandra as a single-node cluster, which suits development, testing and smaller production workloads. Cassandra scales horizontally by adding nodes. To build a multi-node cluster:
- Launch additional instances from this same AMI, one per node, in the same VPC.
- Allow inbound TCP port
7000between the nodes for internode communication, and port9042from your application tier.
- On every node, edit
/etc/cassandra/cassandra.yaml. Setlisten_addressandrpc_addressto the node's own private IP address, and set theseedsvalue underseed_providerto the private IP addresses of one or two seed nodes.
- Raise the
replication_factorof your keyspaces, and considerNetworkTopologyStrategy, so that data is replicated across the cluster.
- Restart Cassandra on each node and confirm with
nodetool statusthat every node reaches theUNstate.
The Apache Cassandra documentation at https://cassandra.apache.org/doc/latest/ covers cluster topology, replication, repair and performance tuning in depth.
Screenshots
A cqlsh session creating a keyspace and table, inserting a row and reading it back on the running Cassandra node.
The nodetool status command showing the Cassandra node Up and in a Normal state in datacenter1.
The nodetool info command reporting node health, heap memory, uptime and data load for the running Cassandra node.
Support
SecureAnyCloud provides 24/7/365 technical support for this image, with a guaranteed response within 24 hours and a one-hour average for critical issues. Contact sales@secureanycloud.com.
For general Apache Cassandra administration questions, see the official documentation at https://cassandra.apache.org/doc/latest/.
Deploy on AWS
Launch Apache Cassandra on AWS with 24/7 support from SecureAnyCloud.
View on Marketplace
Need Help?
Our support team is available 24/7.
sales@secureanycloud.com