I've been able to access AWS ec2 instance for almost two months until yesterday suddenly stopped working
ssh: connect to host ec2-XX-XX-XXX-XX.compute-1.amazonaws.com port 22: Connection timed out
The security group is alright there is nothing wrong with it, I even created a new one but I still have the same issue, I rebooted the instance still the same issue, I stopped it and restart which many don't recommend but I couldn't access it either, And yes when I rebooted the instance the public IP changed and I used it to access to the instance but in vein. I'm using the free tier, and able to access the project from the public IP I only can't access the instance. I've read, searched, and tried many solutions, for example:
AWS ssh access 'port 22: Operation timed out' issue and many more ... The only thing that I did before it stopped working, was following this tutorial: https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-20-04 in order to secure Nginx, and I think it may be the reason why it stopped working.
Any help will be appreciated Thank you.