Amazon MemoryDB: What is it?
A robust in-memory database service with lightning-fast performance is Amazon MemoryDB. It is specifically designed for microservices-based modern applications.
The well-known open source data stores Valkey and Redis OSS are compatible with Amazon MemoryDB, allowing you to easily create applications utilising the same adaptable and user-friendly data structures, APIs, and commands that they already employ. With MemoryDB, you may achieve fast throughput with single-digit millisecond write and microsecond read latency since all of your data is stored in memory. In order to provide quick failover, database recovery, and node restarts, MemoryDB further uses a Multi-AZ transactional log to store data durably across several Availability Zones (AZs).
Amazon MemoryDB can be used as a high-speed primary database for your microservices applications, providing both in-memory performance and Multi-AZ durability. This eliminates the need to manage a cache and durable database separately.
Use cases
Applications of generative AI in real time
Among the most popular vector databases on AWS, provide real-time personalised experiences with the fastest semantic search speed and the highest relevancy.
Create mobile and web apps
Utilise Redis OSS and Valkey’s built-in access to configurable data structures to expedite application development and enhance time-to-market.
Create online games
Construct leaderboards, player data stores, and session histories for gaming apps that need to be scalable, low latency, and highly concurrent in order to update in real time.
Stream entertainment and media
To handle millions of requests daily for media and entertainment applications, run high concurrency streaming data streams.
MemoryDB’s features
A robust in-memory database service with lightning-fast performance is Amazon MemoryDB. MemoryDB’s features include:
- Strong primary node consistency and eventual replica node consistency that is assured.
- Up to 160 million TPS per cluster with single-digit millisecond write and microsecond read latencies.
- Redis OSS and Valkey data structures and APIs are user-friendly and adaptable. Almost minimal changes are needed for creating new applications or migrating current Redis OSS and Valkey-based applications.
- Fast database recovery and restart are made possible by data durability using a Multi-AZ transactional log.
- Automatic failover, multi-AZ availability, and node failure detection and recovery.
- Easily scale vertically by switching to larger or smaller node types, or horizontally by adding and removing nodes. Shards and replicas are two ways to increase write and read throughput, respectively.
- Primary nodes have read-after-write consistency, while replica nodes have eventual consistency that is assured.
- MemoryDB facilitates user authentication using Access Control Lists (ACLs), encryption in transit, and encryption at rest.
- Snapshots that are taken automatically and stored in Amazon S3 for a maximum of 35 days.
- More than 100 TB of storage per cluster (with one replica per shard) and up to 500 nodes are supported.
- TLS for in-transit encryption and AWS KMS keys for encryption at rest.
- Using Redis OSS with Valkey for user authorisation and authentication utilising Access Control Lists (ACLs) for user authentication.
- AWS Graviton2 instance types are supported.
- Integration with additional AWS services for security, monitoring, and alerting, including CloudWatch, Amazon VPC, CloudTrail, and Amazon SNS.
- Completely handled software updates and patches.
- Tag-based access control for administration APIs and connection with AWS Identity and Access administration (IAM).
Amazon MemoryDB Associated services
AWS Elasticache vs MemoryDB
Examine the following comparisons while choosing between MemoryDB and ElastiCache:
For workloads requiring an extremely fast primary database, MemoryDB is a robust in-memory database. If your workload calls for a robust database with lightning-fast performance (microsecond read and single-digit millisecond write latency), you should think about utilising Amazon MemoryDB. If you wish to create an application with a primary, long-lasting database that uses Redis OSS or Valkey data structures and APIs, MemoryDB might also be a good fit for your use case. Lastly, by substituting a cache for a database for durability and performance, MemoryDB can simplify your application architecture and reduce expenses.
ElastiCache is a popular service that uses Redis OSS and Valkey to cache data from other databases and data stores. If you wish to speed up data access using your current primary database or data store (microsecond read and write performance), you should think about using ElastiCache for caching workloads. For use scenarios when you wish to access data stored in a primary database or data store using the Valkey or Redis OSS data structures and APIs, you should also take ElastiCache into consideration.
Accessing MemoryDB
Every Amazon MemoryDB cluster endpoint has a port and an address. Clients can learn the unique roles, IP addresses, and slots for every cluster node with this cluster endpoint’s support for the Valkey and Redis OSS Cluster protocols. You can use the Redis OSS Cluster protocol or the Valkey protocol to connect to the cluster endpoint and find the new primary in the event that a primary node fails and a replica is promoted in its place.
To find node endpoints using the cluster nodes or cluster slots command, you must establish a connection to the cluster endpoint. You can connect straight to the node for read/write requests once you’ve found the correct node for a key. The cluster endpoint can be used by a Redis OSS or Valkey client to automatically connect to the appropriate node.
Node-specific endpoints can also be used to debug individual nodes within a cluster, however regular use does not require them.
Amazon MemoryDB Security
Three tiers of security management are in place for MemoryDB:
AWS Identity and Access Management (IAM) is used to restrict who has the ability to administer MemoryDB clusters and nodes. Your AWS account must have IAM policies that allow the necessary permissions to carry out operations when you connect to AWS using IAM credentials.
You create users with certain permissions and add them to the Access Control Lists (ACL) in order to manage the levels of access to clusters. In turn, one or more clusters are linked to the ACL.
A virtual private cloud (VPC) built on the Amazon VPC service is required for MemoryDB cluster creation. A VPC security group is used to manage which devices and Amazon EC2 instances are allowed to establish connections to the endpoint and port of the node for MemoryDB clusters in a VPC. Secure Sockets Layer (SSL) and Transport Layer Security (TLS) can be used to establish these endpoint and port connections. Additionally, your company’s firewall rules might regulate whether or not devices operating within your organisation are able to establish connections to a MemoryDB cluster.
Amazon MemoryDB Pricing
Amazon MemoryDB is a robust, in-memory database that offers multi-AZ durability and lightning-fast performance, and it is compatible with Redis OSS and Valkey. There is no minimum cost when using Amazon MemoryDB; you simply pay for what you use. The smallest unit of a MemoryDB cluster is called a node. You can choose a node type according to your requirements, and each node supports different amounts of memory and compute capacity. Three factors determine how much you pay: the amount of data written to your cluster, the number of on-demand instance hours per node, and the amount of snapshot storage you utilise.
Compared to MemoryDB for Redis OSS, Amazon MemoryDB for Valkey is 30% less expensive. Up to 10 TB of data can be written for free each month using MemoryDB for Valkey. The cost of $0.04/GB for data written beyond 10 TB per month is 80% less than MemoryDB for Redis OSS.
Start using Amazon MemoryDB for free
You can begin using MemoryDB for free as part of the AWS Free Tier. When new users sign up, they get 20 GB of data per month for free for two months and 750 hours of MemoryDB on db.t4g.small instances.
All of worldwide locations’ participating services are eligible for the Amazon AWS Free Tier. Free usage does not accrue under the AWS Free Tier; instead, it is computed monthly across all locations and automatically applied to your payment. Currently, the AWS GovCloud (US) and China (Beijing) regions do not offer the AWS Free Tier. For more details visit the pricing page.