Redis
Overview
Redis is an in-memory key-value store widely used as a database, cache, message broker and streaming engine. Redis 7.4 is the final open source release line under the BSD-3-Clause licence. It is the last release before Redis Inc. moved Redis to the SSPL/RSAL split licence, so this image suits teams that need an unambiguously open source build of Redis.
This SecureAnyCloud image runs Redis 7.4 on Amazon EC2 as its only workload. The server comes from the official Redis package repository and runs under its package systemd unit. The image is otherwise headless, and you administer Redis over SSH with the redis-cli command-line client.
What you get:
- Redis 7.4, installed from the official Redis package repository and managed by its package systemd unit
- Authentication enforced from the moment the server starts. On the first boot of your instance, a oneshot service generates a fresh, strong password for the default Redis user, applies it to the running server, and writes it to
/root/redis-credentials.txt, a file that only the root user can read. - No shared or default Redis credential in the image
- nginx on port 80, serving a small static identification page. The AWS Marketplace primary HTTP health check uses this page, and you can open it in a web browser to confirm that the image is alive. The page never embeds the rotated Redis password, which is available only over SSH.
- 24/7 SecureAnyCloud support
Prerequisites
Before you deploy this image, make sure you have:
- An Amazon Web Services account in which 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 that allows inbound port 22 from your management network and, optionally, inbound port 6379 from the application servers that need to reach Redis
- 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. Redis is memory bound, so size your instance to hold your working set in RAM comfortably, with headroom for the operating system and persistence buffers.
Launch the Instance from the AWS Marketplace
Sign in to the AWS Management Console, open the EC2 service, and select Launch instance. Under Application and OS Images, choose AWS Marketplace AMIs and search for Redis. Select the SecureAnyCloud listing, choose Select, and then choose Continue on the subscription summary.
Choose an instance type of m5.large or larger, and choose your EC2 key pair under Key pair (login). Under Network settings, select your VPC and subnet. Create or select a security group that allows inbound port 22 from your management network and port 6379 from the CIDRs that need to reach Redis.
Open port 80 as well if you want to confirm from a web browser that the image is alive, using the static identification page. Keep the root volume at the default size or larger.
Select Launch instance. First-boot initialisation generates the requirepass and starts Redis. It takes a few seconds after the instance state becomes Running and the status checks pass.
Launch the Instance from the AWS CLI
Run the following command to launch an instance from the SecureAnyCloud Redis 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":20,"VolumeType":"gp3"}}]' \
--tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=redis-01}]'On success, the command prints a JSON document. Note the instance ID, and then retrieve the public address once the instance is running with this command:aws ec2 describe-instances --instance-ids <instance-id> --query "Reservations[].Instances[].PublicIpAddress" --output text.
Confirm the Image Is Alive in a Browser
While the instance is starting, open http://<public-ip>/ in any web browser to confirm that the image is alive. The image serves a small static identification page on port 80. The page names the product and tells you which file holds the rotated Redis password, but it never embeds the password.
If you do not want to expose port 80 to the public internet, restrict the security group rule to your management network or remove the rule. The identification page is a convenience, and Redis itself does not need it.
Connect over SSH
Connect over SSH with the key pair that you selected and the public IP address from step 2. For the Redis 7.4 on Ubuntu 24.04 AMI variant, the SSH login user is 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 Redis is already initialised by the time you can log in.
Retrieve the Generated Redis Password
The first-boot service generates a fresh requirepass for this instance and writes it, with the connection details, to /root/redis-credentials.txt. Only the root user can read the file. Display it from your SSH session:
sudo cat /root/redis-credentials.txtThe file looks like this, but your instance has its own unique password:
# Redis 7.4 -- Per-Instance Credentials
# Generated at first boot: Sun May 24 23:45:14 UTC 2026
#
# Connect locally on the instance:
# redis-cli -a '<REDIS_PASSWORD>' --no-auth-warning PING
# -> PONG
# redis-cli -a '<REDIS_PASSWORD>' --no-auth-warning SET hello world
# redis-cli -a '<REDIS_PASSWORD>' --no-auth-warning GET hello
#
# Connect from your VPC (the security group must allow 6379 from your CIDR):
# redis-cli -h <public-ip> -p 6379 -a '<REDIS_PASSWORD>' --no-auth-warning PING
# redis_user=default requirepass=<REDIS_PASSWORD> REDIS_USER=default REDIS_PASSWORD=<REDIS_PASSWORD> LISTEN_PORT=6379 LISTEN_ADDRESS_LOCAL=127.0.0.1 LISTEN_ADDRESS_VPC=0.0.0.0Store the password somewhere safe. The first-boot service updates this file each time it runs, but it runs only once per instance, so later boots leave the file unchanged.
Confirm the Redis Server Is Active and Listening
Redis and nginx both run as systemd services. Confirm that they are active:
sudo systemctl is-active redis-server.service
sudo systemctl is-active nginx.serviceExpected output:
active activeConfirm the listening sockets. Redis listens on TCP 6379 and nginx on TCP 80:
sudo ss -tln | grep -E ":(6379|80) "Expected output:
LISTEN 0 511 0.0.0.0:6379 0.0.0.0:* LISTEN 0 511 0.0.0.0:80 0.0.0.0:*Check the installed Redis version with the bundled redis-cli client:
redis-cli --versionExpected output:
redis-cli 7.4.9Open the Redis Command Line Client
Read the requirepass from /root/redis-credentials.txt and use it with redis-cli. The simplest approach is a one-liner that reads the password and stores it in a shell variable for the rest of the session:
PASS=$(sudo grep '^REDIS_PASSWORD=' /root/redis-credentials.txt | cut -d= -f2-)
redis-cli -a "$PASS" --no-auth-warning PINGExpected output:
PONGThe --no-auth-warning flag suppresses a harmless warning about passing the password on the command line. To keep the password out of your shell history, you can also supply it through environment variables or ~/.bashrc style configuration.
Store and Read a Key
Store a key and read it back. The commands below read the password again so that the snippet is self-contained. In an interactive session, the $PASS variable from the previous step is still in scope.
PASS=$(sudo grep '^REDIS_PASSWORD=' /root/redis-credentials.txt | cut -d= -f2-)
redis-cli -a "$PASS" --no-auth-warning SET mykey "hello sac"
redis-cli -a "$PASS" --no-auth-warning GET mykeyExpected output:
OK hello sacYou can also use Redis from any host that can reach port 6379 on the instance. From your workstation or application server, run:
redis-cli -h <public-ip> -p 6379 -a '<password>' --no-auth-warning PINGMake sure that the security group on the instance allows inbound TCP 6379 from the source CIDR. Redis refuses anonymous connections regardless of the security group, because authentication is enforced inside Redis itself.
Inspect Redis Server State
The INFO command returns detailed operational information. Its server section shows the version, build identifier, mode and host kernel:
PASS=$(sudo grep '^REDIS_PASSWORD=' /root/redis-credentials.txt | cut -d= -f2-)
redis-cli -a "$PASS" --no-auth-warning INFO server | head -10Expected output:
# Server redis_version:7.4.9 redis_git_sha1:00000000 redis_git_dirty:0 redis_build_id:74932331a9f87821 redis_mode:standalone os:Linux 6.8.0-1009-aws x86_64 arch_bits:64 monotonic_clock:POSIX clock_gettime multiplexing_api:epollOther useful sections are clients, memory, persistence, stats, replication and keyspace. Pass the section name as the argument to INFO, for example INFO memory.
Persistence, Memory and Replication
The image enables RDB snapshot persistence with the upstream Redis defaults (save 3600 1, save 300 100, save 60 10000), and writes snapshots under /var/lib/redis. To enable append-only file persistence for write-heavy durability, set the following in /etc/redis/conf.d/sac-persistence.conf and restart Redis:
appendonly yes appendfsync everysecsudo systemctl restart redis-serverNo memory cap is set by default, so Redis uses all available RAM. For a cache workload, set maxmemory and an eviction policy in /etc/redis/conf.d/sac-memory.conf:
maxmemory 4gb maxmemory-policy allkeys-lrusudo systemctl restart redis-serverFor replication, run a second instance from this AMI in the same VPC and security group. Configure the replica to follow the primary by adding two settings to /etc/redis/conf.d/sac-replica.conf: a replicaof <primary-ip> 6379 line, and the primary's requirepass in masterauth.
The upstream Redis documentation at https://redis.io/docs/latest/operate/ covers replication and Sentinel in detail.
Service Management
Redis and nginx are standard systemd units. Use these commands to manage them:
sudo systemctl status redis-server.service
sudo systemctl restart redis-server.service
sudo journalctl -u redis-server.service --since "1 hour ago"The Redis configuration is at /etc/redis/redis.conf. SecureAnyCloud adds an include /etc/redis/conf.d/*.conf line, so per-instance overrides live in their own files and survive package upgrades. The first-boot service writes /etc/redis/conf.d/sac-auth.conf with the rotated requirepass.
If you change bind, port or any other listener setting, update the security group to match before you restart Redis.
Screenshots
The Redis 7.4 image shows the following results when you follow this guide:
- Terminal output in which redis-server reports a 7.4.x version string and redis-server.service is active and running.
- A redis-cli session that connects with the rotated per-instance password, and a PING that returns PONG to confirm the server is responsive.
- A redis-cli session that stores a key with SET and reads it back with GET, which confirms that the data path works end to end on the running image.
- The INFO server section, which reports the Redis version, uptime and process id.
Support
This image includes 24/7 technical support by email and chat. SecureAnyCloud helps with Redis deployment, persistence configuration, memory tuning, cache eviction policy choices, replication and operations.
All product and company names are trademarks or registered trademarks of their respective holders. Their use does not imply any affiliation with, or endorsement by, those holders.
Deploy on AWS
Launch Redis on AWS with 24/7 support from SecureAnyCloud.
View on Marketplace
Need Help?
Our support team is available 24/7.
sales@secureanycloud.com