How to access jenkins dashboard on webbrowser in AWS? - amazon-web-services

I am very new to AWS and Devops part, I read some official documentation and I installed Jenkins server in my ec2-instance it's successfully installed and it's running also ,when i try to open by using http://my-public-ip:8080 it's not opening. How to open my Jenkins dashboard in my web browser?
This is my EC2 instance inbound rules:
When I am trying to search in my browser it's showing some thing like this:
This site can't be reached13.235.67.157 took too long to respond.
Try:
Checking the connection
Checking the proxy and the firewall
Running Windows Network Diagnostics
ERR_CONNECTION_TIMED_OUT

I would suggest go to your security group of this instance which is launch-wizard-5 Edit it and You have to choose "Custom TCP rule"
Then you will be able to add the port to 8080
Wait for second
and open http://my-public-ip:8080 in your favorite browser
You'll able to access your Jenkins GUI

Jenkins uses a specific port: 8080
To verify this, inside of your jenkins shell try this:
try with netstat -plnt.
and
curl localhost:8080 -v
If you have a valid response showing you that 8080 port is online, your jenkin is ready to use. Just configure the 8080 port in your AWS inbound rules. Finally you will be able to access with:
http://my-public-ip:8080
If you achieve that, your next goal must be to hide the 8080 port. For that you could use the ELB to assign a custom domain if you have someone.

Add security groups
ALLTraffic
0.0.0.0/0
Then refresh the page

Related

Unable to open Public IPv4 DNS in AWS EC2 - Linux instance

I have a Spring boot project which I want to host on an AWS-EC2 instance. I was able to create its image using Git-hub, Jenkin and docker. I was also able to successfully pull and run this image in the Linux console of my AWS-EC2 instance.
According the tutorial I was following I should have been able to open the project now using the public IPv4 DNS but the response I got was that it refuse to connect.
I know that this usually has to do with Inbound rules so I added a rule to allow all traffic but it didn't help.
For anyone who wants to know:
Git-hub repository: https://github.com/SalahuddinShayan/telecom
Docker-Hub repository: https://hub.docker.com/repository/docker/salahuddinshayan/telecom
Command I used to run the image in AWS:
docker run -p8081:8081 --name final-app --link docker-mysql:mysql salahuddinshayan/telecom
Security Groups:
Networking Details:
Here is the Error:
I am completely stumped by it. Does anyone an idea on what to do to fix this?
Please check if your client is calling the right protocol, e.g. http vs https.
You are transmitting on port 8081. http://3.110.29.193:8081/ works fine from the EC2 side. 404 status is raised, so this is a client side error, not a server side error.
It means that no firewall is blocking traffic and a process (your app) was found that listens on IP:Port that you require. The problem is that the process it encountered (your app) is sending only a WhiteLabel Error Page, which is a generic Spring Boot error page that is displayed when no custom error page is present. So the issue is with the Spring app itself and not with EC2 or with connection. In other words: the traffic can reach your Spring app, but your Spring app has nothing to say in response.
As a side note, after deploying your app I would advise to refine the inbound traffic rules to allow only the traffic you want. There is no need of allowing all traffic on all ports.

Can't reach to an AWS EC2 instance website

I just launched a instance on AWS and I'm trying to open the website. So I copy the Public IPv4 address and paste it on my page. But it always returns This site can’t be reached 35.78.183.239 took too long to respond.
I've changed my firewall setting to access google chrome and set security groups HTTP, HTTPS. I can't figure out where the problem is. Any suggestions?
You didn't specify what webserver or AMI is on your EC2 instance.
You need to setup an AMI or manually install and setup a webserver for anything to show, otherwise the EC2 instance, while reachable, will not respond.
Make sure that ssh access is enabled and try ssh into the machine. If you can successfully login, then you know the instance is reachable and the problem is with your webserver software. This will help you debug.
What port is your application running on? When you enable HTTP and HTTPS it only allows ports 80 and 443 on the security group. This won't help if your application runs on a different port, so you'll need to add that to your security group to allow inbound traffic.

Start Django development server on AWS EC2 Amazon Linux

This tutorial here shows how to start the development server on AWS EC2:
ALLOWED_HOSTS=['EC2_DNS_NAME']
...
python manage.py runserver 0.0.0.0:8000
In a browser, navigate to public DNS of the instance, make sure to append port “8000” at the end and if everything was properly configured, it will show the index page of the application.
For example: www.ec2dnsname.com:8000
My public IPv4 DNS is of this form:
ec2-xx-xxx-xx-xxx.region.compute.amazonaws.com
So, in my settings.py
ALLOWED_HOSTS=['ec2-xx-xxx-xx-xxx.region.compute.amazonaws.com']
And run this in the EC2 terminal:
python manage.py runserver 0.0.0.0:8000
However, when I try to reach this address:
www.ec2-xx-xxx-xx-xxx.region.compute.amazonaws.com:8000
nothing is showing up (The page took too long to respond).
Is this the complete and correct way to just try run a development server on AWS EC2?
Update after #Iam_batman response: Below is the Security Group setting attached to my EC2 instance:
All TCP TCP 0 - 65535 0.0.0.0/0 –
All TCP TCP 0 - 65535 ::/0 –
The Port Range seems to cover everything. I still can't access the index page from the development server.
Also, my AWS account is a workplace account, not a personal account. If I follow #iam_batman setup below, using HTTP and SSH protocol, I get denied the access to port 80 and 22 respectively.
Update: To further test, I run a curl command as following :
curl http://ec2-xx-xxx-xx-xxx.region.compute.amazonaws.com:8000
I get the entire HTML code for the standard Django index page (the one with the spaceship). This implies that the website is already available at that address. But for some reason, it does not render on the browser?
There's two things you should check out.
1. Check if security groups are configured.
Search for "Security Groups" in aws dashboard. Find the 'Create Security Group' Button on the top right and create a security group with inbound and outbound rules that allow http traffic on the port you want to communicate with.
Here's an example where i am using the standard 80 port for http. But, you can use 8000 if you want.
Now, you just need to assign the the security group you created to your ec2 instance. Go to EC2 dashboard and select your instance. Then Actions > Security > Change Security Groups. Select the security group you just created and you are good to go.
2. Maybe you need an application server
I have never actually tried deploying with the django development server ( runserver command ) because its not meant for production. For, deploying python based frameworks like django/flask/fast-api you need to use an appserver like: uwsgi, gunicorn etc. So, do give it a look. You need an appserver atleast. For, more production use cases you might need to have an actual webserver like nginx/apache on top of the app server.
These are my two notes on your issue.

ec2 not accepting inbound traffic

So, I've gone through multiple SO threads, but I'm unable to do it.
I launched an ec2 instance and installed ubuntu18.04 to it. I installed nginx on top of it.
Now I'm trying to browse my server IP via browser, but it shows it can't be reached. I tried wget localhost on shell and it downloads a file with content If you see this page, the nginx web server is successfully installed and working. Further configuration is required., which means nginx is working fine.
Now, I edited my Security group config associated with the instance as follow:-
Inbound Settings
Outbound Settings
But, it's still not working. What am I missing?
Can you please check internal firewall on your instance, it is enabled or not. If not try to disable it and see.
https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-with-ufw-on-ubuntu-16-04
Secondly, have you installed any webserver on EC2, otherwise it may not be able to find anything on localhost. There should be a webserver to listen to request on port 80.

Unable to access JBOSS server deployed on Amazon EC2

I have deployed jboss-4.2.3 on an EC2 instance. I have added appropriate rule to open port 8080 for inbound traffic. When I ssh into this instance and do curl localhost:8080, the expected response can be seen
But when I try to access it in a browser on my laptop, am unable to connect. Few other things I have tried to eliminate other possibilities
In order to eliminate possibility of firewall issues on my laptop, have tried to connect from another instance on amazon. Doesnt work
Also tried to configure jboss to listen to port 80. Still it can't be accessed. Apache running on port 80 however responds
Any guidance is highly appreciated
Bind your jboss to all IP addresses as below:
./run.sh -b 0.0.0.0
I was struggling with the same issue.
You need to open up port 8080 in the Security Groups as Wildfly is using it. Then you should be able to access the page.