AWS Security ChangesHomeSearch

AWS AWSEC2 medium security documentation change

Service: AWSEC2 · 2025-03-02 · Security-related medium

File: AWSEC2/latest/UserGuide/TroubleshootingInstancesConnecting.md

Summary

Added documentation about 'Host key verification failed' error, including causes and resolution steps

Security assessment

The change documents host key verification issues which are directly related to SSH security and authentication. It explains how mismatched host keys can occur and provides guidance on verifying host fingerprints, which are security best practices.

Diff

diff --git a/AWSEC2/latest/UserGuide/TroubleshootingInstancesConnecting.md
index d7a9bc465..e89f4229e 100644
--- a/AWSEC2/latest/UserGuide/TroubleshootingInstancesConnecting.md
+++ b/AWSEC2/latest/UserGuide/TroubleshootingInstancesConnecting.md
@@ -5 +5 @@
-Common causes for connection issuesError connecting to your instance: Connection timed outError: unable to load key ... Expecting: ANY PRIVATE KEYError: User key not recognized by serverError: Permission denied or connection closed by [instance] port 22Error: Unprotected private key fileError: Private key must begin with "-----BEGIN RSA PRIVATE KEY-----" and end with "-----END RSA PRIVATE KEY-----"Error: Server refused our key or No supported authentication methods availableCannot ping instanceError: Server unexpectedly closed network connectionError: Host key validation failed for EC2 Instance ConnectCan't connect to Ubuntu instance using EC2 Instance ConnectI've lost my private key. How can I connect to my instance?
+Common causes for connection issuesError connecting to your instance: Connection timed outError: unable to load key ... Expecting: ANY PRIVATE KEYError: User key not recognized by serverError: Permission denied or connection closed by [instance] port 22Error: Unprotected private key fileError: Private key must begin with "-----BEGIN RSA PRIVATE KEY-----" and end with "-----END RSA PRIVATE KEY-----"Error: Host key verification failedError: Server refused our key or No supported authentication methods availableCannot ping instanceError: Server unexpectedly closed network connectionError: Host key validation failed for EC2 Instance ConnectCan't connect to Ubuntu instance using EC2 Instance ConnectI've lost my private key. How can I connect to my instance?
@@ -26,0 +27,2 @@ The following information and common errors can help you troubleshoot connecting
+  * Error: Host key verification failed
+
@@ -473,0 +476,6 @@ To resolve the error, the private key must be in the PEM format. Use the followi
+## Error: Host key verification failed
+
+This error occurs if there is a mismatch between the host key stored on the instance in the `known_hosts` file and on the client. For example, a mismatch can occur if you connect to an instance using one public IP address, and then try to connect to it again using a different public IP address. This can happen after you add or remove an Elastic IP address, as doing so changes the public IP address of an instance.
+
+To resolve this error, start by confirming that there was an expected change to the host key or the network configuration of the instance. Before you connect to the instance, you might also want to [verify the host fingerprint](./connection-prereqs-general.html#connection-prereqs-fingerprint). After you connect to the instance, you can remove the old host key from the `known_hosts` file. For instructions, refer to the documentation for the Linux distribution in use on your instance.
+