Can't access Jenkins running on EC2 instance from browser

Hi everyone,

So I’m trying to install the Jenkins server on a running EC2 instance that was pre-created on AWS (CentOS-based environment).

I have conducted all the necessary steps in advance:

  • Downloaded and installed Jenkins (from the repository)
  • Created inbound and outbound rules (SSH, HTTP on port 80, HTTPS on port 443; TCP on port 8080) for both the Instance itself and Network ACLs
  • The Jenkins service is up and running

[root@ip-172-31-93-145 ec2-user]# systemctl status jenkins
● jenkins.service - LSB: Jenkins Automation Server
Loaded: loaded (/etc/rc.d/init.d/jenkins; generated)
Active: active (exited) since Thu 2022-01-13 15:49:57 UTC; 2 days ago
Docs: man:systemd-sysv-generator(8)
Tasks: 0 (limit: 4724)
Memory: 0B
CGroup: /system.slice/jenkins.service

Jan 13 15:49:54 ip-172-31-93-145.ec2.internal systemd[1]: Starting LSB: Jenkins Automation Server…
Jan 13 15:49:54 ip-172-31-93-145.ec2.internal runuser[1067]: pam_unix(runuser:session): session opened for user jenkins by (uid=0)
Jan 13 15:49:57 ip-172-31-93-145.ec2.internal runuser[1067]: pam_unix(runuser:session): session closed for user jenkins
Jan 13 15:49:57 ip-172-31-93-145.ec2.internal jenkins[1042]: Starting Jenkins [ OK ]
Jan 13 15:49:57 ip-172-31-93-145.ec2.internal systemd[1]: Started LSB: Jenkins Automation Server.

The only issue I am struggling with is accessing Jenkins via the Web (from my local browser) so I can finish the rest of the configuration process. I tried both the hostname and IP address on port 8080 but I am still getting the “This site can’t be reached” error.

Here is the output I have after running the netstat command:
[root@ip-172-31-93-145 ec2-user]# netstat -apn | grep :
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1044/sshd
tcp 0 0 172.31.93.145:22 61.177.173.11:41281 SYN_RECV -
tcp 0 0 172.31.93.145:22 61.177.173.11:56274 SYN_RECV -
tcp 0 36 172.31.93.145:22 178.220.205.169:25341 ESTABLISHED 20248/sshd: ec2-use
tcp 0 0 172.31.93.145:22 61.177.173.11:17110 SYN_RECV -
tcp6 0 0 :::22 :::* LISTEN 1044/sshd
udp 0 0 127.0.0.1:323 0.0.0.0:* 715/chronyd
udp 0 0 172.31.93.145:68 172.31.80.1:67 ESTABLISHED 814/NetworkManager
udp6 0 0 ::1:323 :::* 715/chronyd
unix 3 [ ] STREAM CONNECTED 306071 20248/sshd: ec2-use
unix 2 [ ] DGRAM 306067 20248/sshd: ec2-use
unix 2 [ ] STREAM CONNECTED 305709 20248/sshd: ec2-use
unix 3 [ ] STREAM CONNECTED 306070 20263/sshd: ec2-use
unix 2 [ ] STREAM CONNECTED 306075 20263/sshd: ec2-use
unix 2 [ ] STREAM CONNECTED 305704 20248/sshd: ec2-use

Solutions I have tried so far:
firewall-cmd --zone=public --add-port=8080/tcp --permanent
firewall-cmd --zone=public --add-service=http --permanent
firewall-cmd --zone=public --add-service=jenkins --permanent
firewall-cmd --zone=public --add-source=172.31.93.145/20 --permanent
firewall-cmd --reload
firewall-cmd --list-all

Another thing that confuses me is that there is no Jenkins process running in the background despite the service being active:
[root@ip-172-31-93-145 ec2-user]# ps aux | grep jenkins
root 20361 0.0 0.1 12136 1192 pts/0 S+ 13:50 0:00 grep --color=auto jenkins

Do you have any suggestions?

P.S. I have installed Jenkins on AWS following the official guide.

Hello markov96,

it seems that the Jenkins service is not started well. Can you share the output of journalctl -u jenkins ?

Thanks,
KodeKloud Support