Skip to main content
AWS MemoryDB provides a Redis 7 compatible managed database that is fully compatible with BullMQ. It offers durability, high availability, and automatic failover.

Key Considerations

When using AWS MemoryDB with BullMQ, keep these important points in mind:
  • Cluster mode only - MemoryDB only works in Cluster mode, so you need to use “hash tags” to ensure queues are attached to a specific cluster node
  • VPC access only - MemoryDB can only be accessed within an AWS VPC; you cannot access the Redis cluster from outside AWS

Setup Guide

1

Install IORedis Cluster support

Install the IORedis library which provides cluster support:
2

Create a Cluster connection

Instantiate an IORedis Cluster instance with your MemoryDB endpoint:
3

Use the connection with BullMQ

Pass the cluster connection to your Queue and Worker instances:
4

Graceful shutdown

Always close both the worker and connection when shutting down:

Complete Example

Hash Tags for Cluster Mode

MemoryDB uses cluster mode, which means you should use hash tags in your queue names to ensure all keys for a queue are on the same cluster node. Learn more about Redis Cluster and hash tags.

Best Practices

Enable TLS

Always use TLS for secure connections to MemoryDB

Use VPC Peering

Set up VPC peering if accessing from different VPCs

Monitor Performance

Use CloudWatch metrics to monitor your MemoryDB cluster

Configure Security Groups

Properly configure security groups for access control

AWS ElastiCache

Alternative AWS managed Redis option

Going to Production

Production deployment best practices