Important Requirements
The serverless version of ElastiCache currently uses an incompatible maxmemory-policy and cannot be used with BullMQ.
Setup Guide
1
Create a Security Group
Create a security group that allows your BullMQ services to access ElastiCache.
- Go to EC2 > Security Groups
- Click “Create Security Group”
- Add an Inbound rule:
- Type: Custom TCP
- Port range: 6379
- Source: Choose based on your needs (for testing, “Anywhere” works, but use specific security groups in production)
The cluster will not be accessible outside AWS regardless of the security group configuration.
2
Create a Custom Parameter Group
You need to create a custom parameter group to set the correct
maxmemory-policy.- Go to ElastiCache > Parameter Groups
- Click “Create”
- Fill in:
- Name: e.g.,
bullmq-params - Description: e.g.,
Parameters for BullMQ - Family:
redis7(or latest available)
- Name: e.g.,
- Click “Create”
3
Configure maxmemory-policy
Update the parameter group to use
noeviction policy.- Find your parameter group in the list
- Click “Edit parameter values”
- Search for
maxmemory-policy - Change the value to
noeviction - Click “Save changes”
4
Create or Modify ElastiCache Cluster
Create a new cluster or modify an existing one to use your custom parameter group.For new clusters:
- Go to ElastiCache > Redis clusters
- Click “Create”
- Choose standard cache (not serverless)
- Select your custom parameter group
- Attach your security group
- Find your cluster
- Click “Modify”
- Go to Cluster settings
- Change the Parameter group to your custom group
- Preview changes and “Modify”
5
Attach Security Group
Attach the security group to:
- Your ElastiCache cluster
- The EC2 instances or services that need to access it
Connection Example
Once your ElastiCache cluster is configured, connect to it using BullMQ:Verification Checklist
Before using ElastiCache in production, verify:Security Configuration
Security Configuration
- Security group allows inbound connections on port 6379
- Security group is attached to ElastiCache cluster
- Security group is attached to your application instances
Parameter Configuration
Parameter Configuration
- Created custom parameter group
- Set
maxmemory-policytonoeviction - Applied parameter group to cluster
Cluster Configuration
Cluster Configuration
- Using standard cache (not serverless)
- Redis version 6.2.0 or newer
- Cluster is in the correct VPC
Cluster Mode vs Standard Mode
- Standard Mode (Recommended for Simplicity)
- Cluster Mode (For High Availability)
Use standard mode for simpler setups:
Related Resources
AWS MemoryDB
Alternative AWS managed Redis option with different features
Going to Production
Production deployment best practices
