Implemented keycloak on aws ec2 windows instance and it's running inside the instance only but not running outside the instance - keycloak-connect

I'm using keycloak 15.1.1 version and 64 bit windows ec2 instance.
Downloaded RDP from aws and using RDP I logged into instance and added keycloak and mysql connecor 8.0.31 to connect keycloak with external database.
I referred from here : https://jbjerksetmyr.medium.com/how-to-setup-a-keycloak-server-with-external-mysql-database-on-aws-ecs-fargate-in-clustered-mode-9775d01cd317
I did all as here mentioned.
Note : To run keycloak they(link) used "standalone.sh" command but for windows instance :standalone" is enough.
So I ran keycloak using following command
command 1 : "standalone -b 172.31.35.208" This is my private ip
It's running successfully on 172.31.35.208:9090
Here 9090 port is mapped with 8080 so my keycloak currently running on 9090 port. But if I use this same address outside of the instance it's showing error "This site can’t be reached"
command 2 : "standalone -b http://ec2-35-180-74-78.eu-west-3.compute.amazonaws.com" this is my public DNS
running inside instance
It's running successfully on http://ec2-35-180-74-78.eu-west-3.compute.amazonaws.com:9090/
But if I use this same address outside of the instance it's showing error "This site can’t be reached"
running outside instance
Note : Here -b means, I am telling to my instance that run keycloak on my private Ip or on my public DNS
I tried this : Edited inbound rules to add port 8080 and 9090 to clear traffic but it doesn't work
Anyone can help me to solve this issue
Keycloak service is not accessible from public browser but it's only on inside the instance
Help me to find out the issue

Issue fixed. That issue came because of version 15. Then I used version 19 it's working now

Related

Access to node server and react app hosted on vm via internet

I'm trying some stuff with vms (vmware) and nodejs.
I setup 2 vms runing ubuntu 20.04.5 LTS with static ips let say : 192.168.10.3 and 10.4 each accessible via ssh over internet with my public ip :
ssh -p 103 admin#\<public-ip\>
ssh -p 104 admin#\<public-ip\>
I opened those ports(103 and 104) on windows firewall and forwarded them on the router, everything is fine till now.
In one vm (10.4) i installed the node server running on port 3000 ( which i can access from windows in : 192.168.10.4:3000) and a react app (it can be anything using a different port) on 3001.
How can i access the node server or/and the react app using my public ip ?
i tried on the browser : public-ip:104 but firefox blocked it "This address uses an unusual network port for web browsing. As a security measure, Firefox dropped the request."
public-ip:3000 is not working either

Serve node Webapp on port 80 in amazon ec2

I have a node application listening on port 80, I have set the security groups open on port 80.
But, when I access my webapp in browser via public ip(http://xx.xxx.xx.xxx/), it doesn't show up.
What could be the issue?
I've use this doc as a guide https://aws.amazon.com/premiumsupport/knowledge-center/connect-http-https-ec2/
When your security group already allowed traffic It means something wrong with the instance.
The first step to debug such an issue to verify the application status inside the instance.
do ssh to the instance and verify is the instance responding on localhost curl localhost
check is the process running, if you are using any nodejs process manager like pm2 pm2 list or forever forever list or ps -aux | grep node
Verify is the server running on port 80.
check is the port occupied netstat -antu | grep LISTEN
In short, if the application responding on localhost using curl localhost, then as mentioned in the comment then the instance is in the private subnet.
you can check this article to know about public and private subnet.
So The answer was, my security groups were fine. My app wasn't running because I didn't set the environment variable correctly. sudo PORT=80 node server.js was the command I needed.

"The connection was reset" after starting my server [duplicate]

I'm running a webpack-dev-server application inside a Docker container (node:4.2.1). If I try to connect to the server port from within the container - it works fine. However, trying to connect it from the host computer results in reset connection (the port is published, of course). How can I fix it?
This issue is not a docker problem.
Add --host=0.0.0.0 to your webpack command.
You need to connect to your page like this:
http://host:port/webpack-dev-server/index.html
Look to the iframe mode
You need to make sure:
you docker container has mapped the EXPOSE'd port to a host port
docker run -p x:y
your VM (if you are using docker machine with a VM) has forwarded that mapped port to the actual host (the host of the VM).
See "How to access tomcat running in docker container from browser?"

Unable to connect to remote mongodb instance from nodejs deployed on Amazon EC2 VM

I am unable to connect to remote mongodb service deployed using Mlabs. I am able to connect to this service from the node server deployed on my local machine but it does not works when I try to deploy it on Amazon EC2 windows instance.
I have opened the following inbound and outbound rules.
enter image description here
enter image description here
I have also opened the firewall rules for that, but still it does not works.
I am trying to connect to it using mongoose in nodejs.
mongoose.connect('mongodb://user:pass#ds031947.mlab.com:31947/db');
As you said its accessible from your local system so most probably you have your bind-ip set to localhost instead of public ip.
open your /etc/mongodb.conf and make sure the bind ip is set to public access not local host.
run on EC2 instance:
netstat -pl
the output must shows
tcp 0 0 0.0.0.0:27017 : LISTEN 2025/mongod
if it shows localhost:27017 you have to change the config file to make it accessible to public.
Hope it will help !

External access to Node.JS app, within Docker container

i have a Node app running within a Docker container, hosted on Elastic Beanstalk (single instance). The docker has port 3000 exposed to access the app within the docker, and I can 'curl 172.17.0.32:3000/test' from the host which returns the expected response.
The problem I have is accessing this port externally using the elastic beanstalk url. i.e
http://XXXXXX-env.elasticbeanstalk.com:3000/test
This will time out.. can anyone recommend how to gain access to this port externally?
thanks
Check this for reference
http://victorlin.me/posts/2014/11/26/running-docker-with-aws-elastic-beanstalk
see what your docker ps command returns.
The ip you have shared looks like private ip address of the docker service used for internal network. You have to enable a bridge between your host and docker container by supplying -p 3000:3000 to the run command and finally enable the app in your elastic console.

Resources