How to connect with elasticache using redis in nodejs

Viewed 19

I have created a elasticache redis cluster in aws. Now I have endpoint(url + port)

Url looks "myredis.abc.xyz.cache.amazonaws.com" and port 6379

Now I want to store Key:Value pair in it, like we store in native Redis (redis.set, redis.get)

How to write nodejs code for it, I don't know. I searched a lot but didn't find any right resource.

Anyone can help me in this?

I tried following code but didn't work

    ElastiCacheClient,
    AddTagsToResourceCommand,
  } = require("@aws-sdk/client-elasticache");
  const conf = {
    host: "myredis.abc.xyz.cache.amazonaws.com",
    port: 6379,
    region: "us-east-1",
  };
  const client = new ElastiCacheClient(conf);
  const param = { manoj: "kumawat" };
  const command = new AddTagsToResourceCommand(param);
  const data = await client.send(command);
  console.log(data);
0 Answers
Related