Skip to main content

Module: memorydb

This module allows an engineer to provision MemoryDB clusters along with an admin user, subnet group, and parameter group. MemoryDB is a real-time in-memory database with API compatibility for Redis.

Introduction

AWS MemoryDB is a fully managed, Redis-compatible, in-memory database service that delivers ultra-fast performance and Multi-AZ durability for modern applications built using microservices architectures. MemoryDB also boasts the fastest vector search recall rates in the industry. With single-digit millisecond latency, MemoryDB can work with vector data at real-time speeds for AI models that demand performance.

Usage

For a complete example, see the examples/complete directory.

For automated tests of the complete example using Terratest (which tests and deploys the example on AWS), see the test directory.

provider "aws" {
region = "us-west-2"
}

# Create a standard label resource. See [null-label](https://github.com/cloudposse/terraform-null-label/#terraform-null-label--)
module "label" {
source = "cloudposse/label/null"
# Cloud Posse recommends pinning every module to a specific version
# version = "x.x.x"

namespace = "eg"
environment = "usw2"
stage = "sandbox"
name = "memorydb"
}

module "example" {
source = "cloudposse/memorydb/aws"
# Cloud Posse recommends pinning every module to a specific version
# version = "x.x.x"

ssm_parameter_name = "${module.label.id}/admin_password"

context = module.label.context
}

Quick Start

This module relies on two other AWS services:

  • AWS VPC (Virtual Private Cloud)
  • AWS SSM (Systems Manager)

Make sure you either have a default VPC already made or have subnet IDs for any other VPC. At a minimum specify these variables:

  • ssm_parameter_name - the name of the SSM parameter that stores the admin password for the MemoryDB cluster
  • subnet_ids - required if not using a default VPC, this is a list of subnet IDs where the MemoryDB cluster will be deployed
  • security_group_ids - required if not using default security groups, this is a list of security group IDs to attach to the MemoryDB cluster

See our VPC module for creating a VPC. See our Security Group module for creating security groups.

Examples

Here is an example of using this module: