How do I fix Connection refused or Connection timed out errors when connecting to an EC2 instance?