0
votes

I'm experiencing this weird issue, where I can SSH connect to a new EC2 instance for couple seconds then the connection will drop by itself and once it is dropped I can no longer reconnect while the EC2 instance is still shown running on AWS Management Console.

Note that I use AWS Management Console to create a Default VPC, and I double checked that:

  1. I use the public IP and also tried associating an elastic ip.
  2. the Security Group is allowed inbound traffic on port 22 for my IP.
  3. The VPC route table has a route of forwarding all traffic 0.0.0.0/0 to the internet gateway
  4. Network ACL has allow all port, all protocol on 0.0.0.0/0
  5. And the subnets are associated with the Network ACL
  6. And IPv4 CIDR is configured and IPv6 CIDR are not.
  7. And my private key file is correct.
  8. Verified that Comcast (my ISP) is not block port 22 traffic.
  9. Tried setting port forwarding/triggering
    1. I use Amazon Linux 2 AMI (HVM), SSD Volume Type - ami-009d6802948d06e52 (64-bit x86) without any user script and customizations.
    2. I also tried turning off the router firewall and Windows firewall

I have been trying to resolve this for 3 days now, anything that I missed? any suggest would be greatly appreciated! Here are some more details: VPC: enter image description here Route Table: enter image description here Subnets: enter image description here Subnets Associations: enter image description here Network ACL inbound ruless enter image description here Network ACL outbound rules: enter image description here EC2: enter image description here Security Group Inbound: enter image description here Security Group Outbound: enter image description here

SSH command to connect with gitbash on windows 10 in a path containing my private key: ssh -i "ming-lenovo.pem" [email protected] enter image description here

As this image shown below, I was connected for couple seconds and disconnected by itself: enter image description here

1
This is Serverfault SE question. By the way, try add 127.0.0.1 <yourhostname> to `/etc/host. In addition, try to use alternate connection such as different ISP / proxy/VPN. Because some ISP may mess up with ssh.mootmoot
This does not explain why I can connect for couple seconds, and run "ls", "cd" , etc. commands over ssh connect in gitbash, but thanks for the suggestion, I'll give it a shot anyway.Ming Lu

1 Answers

0
votes

Update: I am answering my own question here. It was confirmed by the AWS that my account was blocked, I've reviewed your account and can confirm there appears to have been a block on your account preventing you from connecting to your instance. Not to worry, I went ahead and worked with the service team to remove this restriction for you. I think we happened what was my account is suspended and reactivated, and for some reason AWS side has a bug of unblocking my account as part of the reactivating process.