Omk*_*kar 11 amazon-ec2 amazon-web-services
我启动了一个新的 Amazon Linux 2 实例。我尝试通过管理控制台中Connect->EC2 Instance Connect (browser-based SSH connection)选项下的 EC2 实例连接选项连接到实例。我收到错误:
There was a problem setting up the instance connection
An internal error has occurred within the remote server, and the connection has been terminated.
If this instance has just started up, try again in a minute or two.
Run Code Online (Sandbox Code Playgroud)
SSH 端口对外开放(0.0.0.0/0)。我能够使用通过本地机器终端配置的 SSH 密钥连接到 EC2 实例,但是从浏览器连接的实例不起作用。
小智 8
为了使用“EC2 Instance Connect(基于浏览器的 SSH 连接)”连接到您的实例,您需要将ec2-instance-connect安装到您的 AMI。
尝试通过“独立 SSH 客户端”(例如 putty)连接到您的实例并使用命令安装它:
sudo yum install ec2-instance-connect
Run Code Online (Sandbox Code Playgroud)
或(对于 Ubuntu):
sudo apt-get install ec2-instance-connect
Run Code Online (Sandbox Code Playgroud)
对我来说这很有效,然后我下次可以通过浏览器轻松访问我的实例。
更详细的解释可以在这里找到:https : //docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-connect-set-up.html
大多数情况下,当您尝试启用 ufw 时会发生这种情况。因此,请按照以下操作通过 SSH 再次获得访问权限:
Run Code Online (Sandbox Code Playgroud)Content-Type: multipart/mixed; boundary="//" MIME-Version: 1.0 --// Content-Type: text/cloud-config; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="cloud-config.txt" #cloud-config cloud_final_modules: - [scripts-user, always] --// Content-Type: text/x-shellscript; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="userdata.txt" #!/bin/bash ufw disable iptables -L iptables -F --//
| 归档时间: |
|
| 查看次数: |
15687 次 |
| 最近记录: |