AWS Ubuntu can't ssh after install apache

On our EC2 instance (t2/Ubuntu) I've been able to ssh to the instance but can't any longer.

I installed Apache and then tried accessing the web server via the IP. With no luck I assumed possibly firewall issue so I then tried using the command

sudo ufw allow 'Apache'

and I believe I received "inactive", so I then entered the following

sudo ufw enable

After issuing the above and checking the ufw status I got

Output Status: active

To           Action From
--           ------ ----

OpenSSH (v6) ALLOW  Anywhere (v6)
Apache (v6)  ALLOW  Anywhere (v6)

I then tried to ssh from the 2 accounts I had setup, but can no longer access the server via SSH.

Did I block SSH? If so how do I open this up again?


Solution 1:

To get this working either disable firewall or allow required port in firewall. Off course, still you need to login into ec2 instance to get this done. There are 3 ways to connect with ec2 instance enter image description here

SSH is not working so I choose Session Manager (Browser based ssh). I follow this video and was able to connect with instance through session manager.

After login i just disable the firewall and every thing works fine.

sudo ufw disable

All the inbound rules working properly.