I had a problem connecting to aws elasticache, I found some solutions but couldn’t solve the problem. Hope anyone can help.
const redis = createClient({
socket: {
host: process.env.REDIS_HOST,
port: Number(process.env.REDIS_PORT),
tls: true,
connectTimeout: 30000,
},
});
error logs
Redis Client Error Error: connect ETIMEDOUT
2
Answers
The ETIMEDOUT error typically occurs when the connection to the AWS ElastiCache (Redis) cluster cannot be established within the specified timeout. Check the connectivity, security groups, make sure the host name is correct.
Simple debug step: try to connect with cli command from the same security group, networking, and see wether you can connect or no.
ElastiCache servers don’t get public IP addresses. If you do a DNS lookup of that hostname you are trying to connect to, you will see it is a private IP address that will only work within your VPC.