Valkey is an open-source, in-memory data store, originally forked from Redis. Amazon ElastiCache is a managed service that supports both Redis and Valkey engines. In 2024, AWS introduced ElastiCache Serverless for Redis and Valkey, providing a serverless, auto-scaling, and fully managed caching solution.
Here’s how Valkey serverless works in ElastiCache:
1. Serverless Model
- No Cluster Management: You don’t need to provision or manage nodes, clusters, or shards. AWS handles all infrastructure.
- Auto-Scaling: The service automatically scales resources up or down based on your workload, including memory and compute.
- Pay-per-Use: You are billed based on the actual data stored and requests made, not for provisioned capacity.
2. How It Works
a. Endpoint
- You create a Valkey serverless cache and receive a single endpoint.
- Applications connect to this endpoint using standard Valkey/Redis clients.
b. Data Storage
- Data is stored in-memory for low latency.
- ElastiCache serverless automatically manages memory allocation and eviction policies.
c. Scaling
- The service monitors your usage and automatically allocates more resources as needed.
- It can handle sudden spikes or drops in traffic without manual intervention.
d. High Availability
- Data is replicated across multiple Availability Zones for durability and fault tolerance.
- Automatic failover is handled by AWS.
e. Security
- Supports VPC, IAM authentication, and encryption in transit and at rest.
3. Valkey Features Supported
- Data Structures: Strings, hashes, lists, sets, sorted sets, etc.
- Pub/Sub: Supported.
- Persistence: Serverless caches are primarily in-memory; persistence options may be limited compared to provisioned clusters.
- API Compatibility: Works with existing Redis/Valkey clients.
4. Use Cases
- Caching (web, session, database query results)
- Real-time analytics
- Leaderboards, counters, pub/sub messaging
5. How to Use
- Create a Serverless Cache: In the AWS Console, choose ElastiCache → Create → Serverless → Valkey.
- Configure Settings: Set memory limits, VPC, security groups, etc.
- Connect Your App: Use the provided endpoint with your Valkey/Redis client library.
- Monitor & Scale: AWS handles scaling and monitoring automatically.
6. Key Differences from Provisioned ElastiCache
| Feature | Provisioned ElastiCache | Serverless ElastiCache (Valkey) |
|---|
| Node Management | Manual | Automatic |
| Scaling | Manual (resize/reshard) | Automatic |
| Billing | Per node/hour | Per GB stored + requests |
| Endpoint | Per node/cluster | Single endpoint |
| Use Cases | Predictable workloads | Variable, unpredictable workloads |
Summary
Valkey serverless in ElastiCache abstracts away infrastructure management, automatically scales to meet demand, and provides a simple, cost-effective way to use Valkey as a cache or data store. You interact with it just like a regular Valkey/Redis instance, but AWS handles all the heavy lifting behind the scenes.
References:
If you need code samples or more technical details, let me know!