Last updated on October 7, 2023
Amazon MemoryDB for Redis Cheat Sheet
- An in-memory database service for microservices-based applications.
- MemoryDB stores all of your data in memory, allowing you to achieve microsecond read and single-digit millisecond write latency and high throughput.
- It also uses a Multi-AZ transactional log to store data across multiple AZs in order to enable fast failover, database recovery, and node restarts.
Features
- Primary nodes have strong consistency, and replica nodes have guaranteed eventual consistency.
- Scale horizontally by adding and removing nodes or vertically by changing node types.
-
- Write throughput – can be increased by adding shards.
- Read throughput – can be increased by adding replicas.
-
- With Amazon S3, you can store snapshots with a retention period of up to 35 days.
- Automatic software patching and cluster upgrades.
- Supports both encryption in-transit / at-rest and authentication of users via ACLs.
Concepts
-
Clusters
-
- A collection of one or more nodes serving a single dataset.
- A dataset is partitioned into shards, and each shard has a primary node and up to 5 optional replica nodes.
- Primary node – serves both read and write requests.
- Replica node – only serves read requests.
- A cluster’s nodes are all designed to be the same node type, with the same parameter and security group settings.
- When a primary node fails over to a replica node, that replica becomes the new primary node for that shard.
- Each MemoryDB cluster has its own Redis engine version.
- Each cluster endpoint has an address and a port that clients can use to discover the specific roles, IP addresses, and slots for each node in the cluster.
- Supports data tiering using a node type from the r6gd family.
- When you create or modify a cluster without specifying a preferred maintenance window, MemoryDB assigns a 60-minute maintenance window within your region’s maintenance window on a randomly selected day of the week.
- Data is automatically backed up to a Multi-AZ transactional log, but you can choose to create point-in-time snapshots of a cluster either periodically or on-demand.
-
-
Nodes
-
- The smallest component of a MemoryDB deployment that runs on an Amazon EC2 instance.
- A node is part of a shard, which is part of a cluster.
- Each node runs an instance of the engine at the version you specified when you set up your cluster.
- Every node has its own DNS name and port number.
- Multiple types of nodes are supported, each with different amounts of memory and processing power.
- When MemoryDB for Redis replaces a node, the new node may have a different IP address. You must update your application configuration to use the new IP address.
-
-
Shards
-
- A hierarchical arrangement of nodes, each wrapped in a cluster.
- A grouping of one to six nodes, with one serving as the primary write node and the other five as read replicas.
- A cluster should always have at least one shard.
- Supports both replication and multiple shards within a cluster.
-
- Parameter groups are named set of engine-specific settings that can be applied to a cluster so that all nodes in the cluster are configured identically.
- Subnet Groups are a set of subnets that you can assign to your clusters in an Amazon VPC environment.
- Access Control Lists (ACLs) are a collection of one or more users.
- Snapshots
-
- Supports automatic snapshots.
- The snapshot window has a minimum length of 60 minutes.
- You can set the retention limit of your snapshots in Amazon S3. The snapshot is automatically deleted when the retention period expires.
-
Security
- To control who has access to clusters, you can create users with specific permissions and add them to ACLs.
- Configure TLS encryption in transit and encryption at rest using AWS KMS keys.
- Use a VPC security group to allow inbound traffic on the node’s endpoint and port to control which devices and Amazon EC2 instances can connect to MemoryDB clusters in a VPC.
Networking
- An Amazon EC2 instance in the same Amazon VPC can connect to your MemoryDB node. Alternatively, you can use VPC peering to connect to your MemoryDB node from another Amazon VPC.
- Your application uses the endpoint to connect to your cluster.
- The endpoint is a unique address that identifies your cluster.
Pricing
- You can choose between two types of nodes:
-
- You are charged per hour for on-demand nodes.
- By reserving nodes in 1-year or 3-year terms, you get discounts on the ongoing hourly usage rate. You can pay using any of the following methods:
- No Upfront – low hourly rate.
- Partial Upfront – lower hourly rate.
- All Upfront – lowest hourly rate.
-
- You are charged based on the amount of data (in GB) written to the MemoryDB cluster.
- You are charged for the additional snapshot storage.
Amazon MemoryDB for Redis Cheat Sheet References:
https://docs.aws.amazon.com/memorydb/latest/devguide/what-is-memorydb-for-redis.html