简体   繁体   English

由于超时错误,无法通过浏览器和 ssh 访问 AWS ec2 实例

[英]AWS ec2 instance not accessible trhough browser and ssh due to timeout error

It's working fine.它工作正常。 All of a sudden it started throwing 504 Timeout error.突然间它开始抛出 504 Timeout 错误。 In SSH it was showing ubuntu upgrade warning, I've installed the necessary and upgraded correctly hoping that it would not throw errors anymore.在 SSH 它显示 ubuntu 升级警告,我已经安装了必要的并正确升级,希望它不会再抛出错误。 But still the issue persist.但问题仍然存在。 I've checked the inbound rules in AWS, all good for port 80,443 and 22. I dont have SSM agent installed in AWS and I dont find the right guide to install that.我检查了 AWS 中的入站规则,所有端口都适用于 80,443 和 22。我没有在 AWS 中安装 SSM 代理,也没有找到正确的安装指南。

Which could have possibly gone wrong?哪个可能出错了?

Based on the comments.根据评论。

The issue was that instance was restarted.问题是该实例已重新启动。 Consequently, the public IP provided by AWS has changed :因此,AWS 提供的公共 IP 发生了变化

We release your instance's public IP address when it is stopped, hibernated, or terminated.当您的实例停止、休眠或终止时,我们会释放您的实例的公共 IP 地址。 Your stopped or hibernated instance receives a new public IP address when it is started.您停止或休眠的实例在启动时会收到一个新的公共 IP 地址

To overcome this issue in the future, you can attach an elastic IP (EIP) to your instance.要在将来解决此问题,您可以将弹性 IP (EIP) 附加到您的实例。 EIP persists between restarts and is free as long as it is attached to a running instance. EIP 在重新启动之间保持不变,只要它附加到正在运行的实例,它就是免费的。

First, attach one elastic IP with your existing instance which then you can one public IP and EIP首先,将一个弹性 IP 与现有实例连接,然后您可以使用一个公共 IP 和 EIP

if you don't attach the EIP every time when you will restart the server you get a new instance IP.如果您每次重新启动服务器时都没有附加 EIP,您将获得一个新实例 IP。

Also, you have to check the security group applied on that instance.此外,您必须检查应用于该实例的安全组。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM