user17336890
user17336890

Reputation:

AWS EC2: ssh: connect to host 10.0.0.206 port 22: Connection timed out

OS: Ubuntu

public IP from where I try the ssh: 153.5.57.2

Security rule:

Inbound:

Name
    Security group rule ID
    IP version
    Type
    Protocol
    Port range
    Source
    Description
    –   sgr-01a63df5e26bc8e9a   IPv4    HTTP    TCP 80  0.0.0.0/0   –
    –   sgr-0cafa26a9ca34ccbe   IPv4    SSH TCP 22  153.5.57.2/32   –
    –   sgr-047038a9c030dd52b   IPv4    HTTPS   TCP 443 0.0.0.0/0   –

Outbound:

Name
    Security group rule ID
    IP version
    Type
    Protocol
    Port range
    Destination
    Description
    –   sgr-0812dc9c3b21745e1   IPv4    All traffic All All 0.0.0.0/0   –

ACL rule: (Inbound and Outbound)

Rule number
    Type
    Protocol
    Port range
    Source
    Allow/Deny

22  SSH (22)    TCP (6) 22  153.5.57.2/32 Allow

100 All traffic All All 0.0.0.0/0 Allow

\*  All traffic All All 0.0.0.0/0 Deny

Route table:

Destination
    Target
    Status
    Propagated

10.0.0.0/24 local Active    No

Internet Gateway is attached to my VPC.

Subnet is attached to my VPC.

Route table is associated with subnet.

ACL rule is associated with subnet.

ssh -vvv -i "my-private-key.pem" [email protected]
OpenSSH_8.2p1 Ubuntu-4ubuntu0.2, OpenSSL 1.1.1f  31 Mar 2020
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug2: resolve_canonicalize: hostname 10.0.0.206 is address
debug2: ssh_connect_direct
debug1: Connecting to 10.0.0.206 [10.0.0.206] port 22.
debug1: connect to address 10.0.0.206 port 22: Connection timed out
ssh: connect to host 10.0.0.206 port 22: Connection timed out

Upvotes: 0

Views: 4696

Answers (1)

John Rotenstein
John Rotenstein

Reputation: 269101

Your security group is permitting access from:

SSH TCP 22  153.5.57.2/32

Therefore, it appears that you are wanting to connect from a computer on the Internet to the Amazon EC2 instance.

However, the command you are using to connect is:

ssh -vvv -i "my-private-key.pem" [email protected]

The IP address of 10.0.0.206 is a private IP address that is only reachable within the VPC. It is not accessible from the Internet.

To access the EC2 instance from the Internet:

  • The instance requires a Public IP address
  • The instance needs to be in a Public Subnet (defined as a subnet that has a Route Table entry to an Internet Gateway)
  • You need to specify the public IP address when connecting to the instance

Upvotes: 1

Related Questions