You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

AWS CloudFormation模板创建EC2实例后无法连接求助

无法通过SSH或Instance Connect连接CloudFormation创建的EC2实例

我使用以下AWS CloudFormation模板成功创建了EC2实例,但无法通过Instance Connect或Putty的SSH方式连接该实例。已按建议为子网关联Internet Gateway,但问题仍未解决。

{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Metadata": {
    "AWS::CloudFormation::Designer": {...}
  },
  "Resources": {
    "vpc1": {...},
    "subnet1": {...},
    "secGrp1": {...},
    "ec2": {...},
    "instanceProfile1": {...},
    "ig1": {...},
    "gateway1": {...},
    "role1": {...}
  }
}

相关错误信息:

  • 堆栈事件日志:截图显示堆栈资源创建完成的事件记录
  • Putty连接超时错误:提示「Network error: Connection timed out」
  • Instance Connect错误:提示「There was a problem connecting to your instance」,下方显示「Failed to connect to your instance. Please try again.」

更新1:
我在CloudFormation中添加了Network ACL配置,错误发生变化但仍无法连接:

"netAcl1": {
  "Type": "AWS::EC2::NetworkAcl",...
},
"MyNetworkAclInboundRule": {...},
"MyNetworkAclOutboundRule": {...}

新错误提示:「Failed to connect to your instance. Error establishing SSH connection: Connection refused」

内容的提问来源于stack exchange,提问作者Devashish Priyadarshi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.25 16:27:06