Issue
After enabling the firewall with 'sudo ufw enable' I can no longer ssh into my ec2 instance. Any way to recover from this? I'm guessing I should have done something like 'sudo ufw allow ssh' but didn't do that before exiting the session. Also, if I had done that, would I be able to ssh in after that, or is there something else I would need to do? Thanks.
Solution
You can recover, but the process is a bit involved.
You will need to detach the volume and reattach it to a new instance. Mount the volume, then find and edit the configuration file to allow ssh through.
Once you are done, you can swap the volume back to the original instance.
In most cases, if you are in VPC and using security groups correctly, you probably wont need a software firewall enabled. Security groups can handle most of the common firewall uses.
Answered By - datasage Answer Checked By - Willingham (WPSolving Volunteer)