错误地禁用了 ec2-user ssh 访问

Disabled ec2-user ssh access by mistake

我通过删除授权密钥禁用了 ec2-user ssh 访问并错误地打开了 public 密钥身份验证。现在我无法访问服务器。

有什么方法可以重新获得访问权限吗?

在某些情况下可以恢复对实例的 ssh 访问。 AWS 文档的 this page 中描述了确切的步骤。

警告:

Do not perform this procedure if your instance is a store-backed instance, because this recovery procedure requires a stop and start of your instance, and any data will be lost. For more information, see Determining the Root Device Type of Your Instance.