Chances are that you’re here because you did something stupid. You locked yourself out of your EC2 instance somehow. Maybe you’ve played with the firewall settings on the machine, maybe you don’t know what you’ve done. Been there, done that. Luckily, there’s a workaround.
In my case, I’ve messed up UFW config on my Ubuntu instance. If you messed up some other configuration, you might have to edit a different file, but the basics of workaround are the same – attaching a disk from the instance you locked yourself out to the recovery instance you’ll create.