Ioredis: connecting to AWS ElasticCache

Created on 28 Aug 2018  ·  4Comments  ·  Source: luin/ioredis

Hi, I'm moving resources from Azure to AWS and am having trouble connecting to Elasticache through ioredis.

Here's my basic config:

const redisClient = new Redis({
  port: process.env.REDIS_PORT,
  host: process.env.REDIS_HOST
})

Here's my Elasticache instance:

image

When trying to connect, it just times out. The strange thing is that if I use node-redis with essentially the same config, it connects immediately.

Anything special that needs to be done?

Thx!

Most helpful comment

Had the same "problem" yesterday, solved it by a coworker who had gone through the same problem some time ago. Posting my solution, maybe it helps out someone else.

You need to add tls: {} to the options, which is a bit counter-intuitive given the API docs and examples.

const Redis = require("ioredis");
const redis = new Redis({
  host: "master.prodGETFROMENVSECRETS.amazonaws.com",
  port: 6379,
  password: "myl33tpa5w00rd",
  tls: {}
});

All 4 comments

Could you enable the debug mode (DEBUG=ioredis:* node yourapp) and post logs here?

Get Outlookhttps://aka.ms/qtex0l for iOS


From: James Dixon notifications@github.com
Sent: Tuesday, August 28, 2018 9:13:35 AM
To: luin/ioredis
Cc: Subscribed
Subject: [luin/ioredis] connecting to AWS ElasticCache (#689)

Hi, I'm moving resources from Azure to AWS and am having trouble connecting to Elasticache through ioredis.

Here's my basic config:

const redisClient = new Redis({
port: process.env.REDIS_PORT,
host: process.env.REDIS_HOST
})

Here's my Elasticache instance:

[image]https://user-images.githubusercontent.com/110114/44694844-2d983480-aa2d-11e8-8a81-2bc6a8ba410d.png

When trying to connect, it just times out. The strange thing is that if I use node-redis with essentially the same config, it connects immediately.

Anything special that needs to be done?

Thx!


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHubhttps://github.com/luin/ioredis/issues/689, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AAmz_gDbRTCxorZVcaUkYpSN2VlQqs4eks5uVJk_gaJpZM4WOvqX.

Not sure what happened but it's working now 👍

Had the same "problem" yesterday, solved it by a coworker who had gone through the same problem some time ago. Posting my solution, maybe it helps out someone else.

You need to add tls: {} to the options, which is a bit counter-intuitive given the API docs and examples.

const Redis = require("ioredis");
const redis = new Redis({
  host: "master.prodGETFROMENVSECRETS.amazonaws.com",
  port: 6379,
  password: "myl33tpa5w00rd",
  tls: {}
});

Ran into this today setting up on Digital Oceans new managed Redis. The only way to get a connection working was to use @renarsvilnis's solution of adding tls: {}. However adding this prevented a connection to localhost for development/test envs so had to only set in production

Was this page helpful?
0 / 5 - 0 ratings

Related issues

saschaishikawa picture saschaishikawa  ·  4Comments

eduleboss picture eduleboss  ·  3Comments

dfee picture dfee  ·  4Comments

luckyscript picture luckyscript  ·  5Comments

hzxuzhonghu picture hzxuzhonghu  ·  5Comments