user1353327
user1353327

Reputation: 41

Connect to AWS ES2 redis instance from another instance

Two instance located in the same VPC and subnet port in redis instance security group: enter image description here

in /etc/redis/redis.conf bind 0.0.0.0 but when

import { createClient } from 'redis';    
const host = 'ec2-some-digits.compute-1.amazonaws.com ';
const port = 6379; // Default Redis port
const client = createClient({ host, port });

i received

enter image description here

redis server: enter image description here and

sudo ufw status
Status: inactive

Upvotes: 0

Views: 103

Answers (1)

user1353327
user1353327

Reputation: 41

the reason in nodejs instance: instead of

  1. const host = 'ec2-some-digits.compute-1.amazonaws.com';
  2. const client = createClient({ host, port });

you should use:

  1. const host = 'redis://ec2-some-digits.compute-1.amazonaws.com';
  2. const client = createClient({ url: host, port: port });

Upvotes: 1

Related Questions