skip to Main Content

I’m trying to connect my friend’s MySQL database remotely but I’m getting connection timeout error. I tried to ssh. But same result.

Then I check that instance. It has public IP. Also allowed 3306 and 22 ports on the security group. Allowed 100th rule for all sources in subnet NACL.

What I’m missing? Is there any other way to block those traffic? Can anyone help me? I’m a still beginner

2

Answers


  1. Chosen as BEST ANSWER

    I found the reason. That instance was deployed in a private subnet and didn't have inbound access.

    Solution:- I deployed a bastion host in a public subnet and used SSH agent forwarding to access the instance through the bastion host.


  2. When an SSH connection times-out, it is normally an indication that network traffic is not getting to the Amazon EC2 instance.

    Things to check:

    • The instance is running Linux
    • The instance is launched in a public subnet, which is defined as having a Route Table entry to points to an Internet Gateway
    • The instance has a public IP address, which you are using for the connection
    • The Network Access Control Lists (NACLs) are set to their default "Allow All" values
    • A Security Group associated with the instance that permits inbound access on port 22 (SSH) either from your IP address, or from the Internet (0.0.0.0/0)
    • Your corporate network permits an outbound SSH connection (try alternate networks, eg home vs work vs tethered to your phone)

    See also: Troubleshooting connecting to your instance – Amazon Elastic Compute Cloud

    Based on your descriptions, I would suggest checking whether the instance was launched in a public subnet.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search