Redis GUI needed for AWS ElastiCache on an EC2 instance
Solution 1
You may want to give a try to Redsmin.
If you have an EC2 instance in the same subnet as your Redis ElasticCache
Note:
- This will only work if the EC2 instance you connect to is in the same subnet as your ElasticCache Redis instance.
- The following example will state that your ElastiCache private IP is
172.31.5.13
and is running on port6379
. - The following example will state that your EC2 private IP is
172.31.5.14
and its public IP is52.50.145.87
.
Now let's do this step by step:
- Connect to this EC2 instance through SSH
- run
sudo iptables -t nat -A PREROUTING -p tcp --dport 6379 -j DNAT --to-destination 172.31.5.13:6379
don't forget to change your IPs and maybe even the port number - run
sudo iptables -t nat -A POSTROUTING -p tcp -d 172.31.5.13 --dport 6379 -j SNAT --to-source 172.31.5.14
- run
sudo service iptables save
-
if the previous command did not work, try:
- on Debian/Ubuntu =>
iptables-save > /etc/iptables/rules.v4
- on RHEL/CentOS =>
iptables-save > /etc/sysconfig/iptables
- on Debian/Ubuntu =>
Add a rule in the security group to allow inbound request from Redsmin IP
62.210.222.165
, protocol=TCP, port=6379- Add a new Direct Server in redsmin with the connection string:
redis://52.50.145.87:6379
, done!
If you don't have an EC2 instance in the same subnet as your Redis ElasticCache
- Follow this amazon tutorial to setup a NAT instance, setup it on the same subnet as your ElastiCache server.
- Now follow the previous section above.
If you simply want to connect Redsmin to an EC2 Redis
- Add a rule in the security group to allow inbound request from Redsmin IP
62.210.222.165
(don't forget to specify the right port, for instance6379
) - Connect your Redis server in Redsmin using the EC2 public IP and the port you opened.
Solution 2
I was able to find the ElastiCache private IP
by pinging the Primary Endpoint from the EC2 shell.
PING xyz.abc.euw2.cache.amazonaws.com (172.31.xxx.xxx) 56(84) bytes of data.
Related videos on Youtube
Alfredo Hinarejos
Updated on September 18, 2022Comments
-
Alfredo Hinarejos over 1 year
I am trying to receive an HTTP POST request from an external provider on my Express server.
When I launch Postman, I get response correctly. But when I do it from a service, no. So I understand that the problem must be from CORS (which is what Postman doesn't use) but I have everything configured correctly:
index.js
const cors = require("cors")({ origin: true }); app.use(cors); app.use(function(req, res, next) { res.setHeader("Access-Control-Allow-Headers", "X-Requested-With,content-type, Accept,Authorization,Origin"); res.setHeader("Access-Control-Allow-Origin", "*"); res.setHeader("Access-Control-Allow-Methods", "GET, POST, OPTIONS, PUT, PATCH, DELETE"); res.setHeader("Access-Control-Allow-Credentials", true); next(); }); app.post('/example', (req, res) => { res.json({ status: 'OK' }); });
It works with postman.
Also, to rule out, I have configured CORS on my NGINX server:
[...] Last-Modified: Tue, 28 Dec 2021 23:03:05 GMT Connection: keep-alive ETag: "61cb97a9-9ef" Access-Control-Allow-Origin: * Accept-Ranges: bytes
Does anyone know where I can have the error and how could it be fixed?
-
jub0bs over 2 yearsDo you get a CORS error in your browser's Console tab? If so, what does the message say? For one thing, you claim to have configured CORS correctly but you should know that
Access-Control-Allow-Credentials: true
is incompatible withAccess-Control-Allow-Origin: *
. -
Alfredo Hinarejos over 2 yearsNo, because not is a front load. Is a service calling Express backend.
-
jub0bs over 2 yearsI don't understand your comment...
-
Alfredo Hinarejos over 2 yearsbrowser console tab does not show nothing because i am not on the browser. it is a service doing a POST req
-
jub0bs over 2 yearsCORS only applies to browsers, not to other user agents. So what you're facing is unrelated to CORS. Please provide more details about how you send the request to that Express backend and explain what happens. Do you get a response at all? Does it just hang? etc.
-
-
lele over 2 yearsthe link to
setup a nat instance
doesn't say anything on setting up a nat instance, do you have any other link/info related to this? -
Alfredo Hinarejos over 2 yearsIt has not worked. I know that the server receives something and cuts it, because it has a peak of activity, but it rejects the connection before capturing any information
-
Amaechi johnkingsley over 2 yearsis there any error showing on your server console? if there is any, You can send a screenshot of it
-
Alfredo Hinarejos over 2 yearsNo, the Nginx console only has 3 errors from a bad configuration that I did with the tests. The Node console does not capture anything either. However, I watch live when I launch the service and see a spike in server CPU usage (barely 3-5%) so something is coming through.
-
jub0bs over 2 years@AlfredoHinarejos About those errors in the NGINX console, see stackoverflow.com/questions/70526302/…