All:
I have an EC2 instance (based on Linux 2, Kernel 4.14), which seems to be in good running condition. I am able to SSH to it (using user name and password. I enabled this). I also verified that the system can be rebooted, and after it, I can still login.
I created an AMI image for the instance, and then launched an instance from the AMI. The status of this new instance showed: "2/2 checks passed", "Instance reachability check passed".
But I could NOT connect to it. When I tried to connect to it from AWS console, it always shows:
"There was a problem connecting to your instance Log in failed. If this instance has just started up, wait a few minutes and try again. Otherwise, ensure the instance is running on an AMI that supports EC2 Instance Connect."
I checked the log, the last steps were:
<14>Jan 29 07:57:25 ec2: ############################################################# <14>Jan 29 07:57:25 ec2: -----BEGIN SSH HOST KEY FINGERPRINTS----- : <14>Jan 29 07:57:25 ec2: -----END SSH HOST KEY FINGERPRINTS----- <14>Jan 29 07:57:25 ec2: ############################################################# -----BEGIN SSH HOST KEY KEYS----- : -----END SSH HOST KEY KEYS----- [ 48.990743] cloud-init[3400]: Cloud-init v. 19.3-44.amzn2 finished at Sat, 29 Jan 2022 07:57:25 +0000. Datasource DataSourceEc2. Up 48.98 seconds
Instance screenshot also shows that it is ready to be connected.
In summary, my question is, the original instance works fine. From it, an AMI image was created. And instance launched from the image can NOT be connected.
What causes this problem ? How to fix it ?