【问题标题】:Terraform SSH Putty ChallengeTerraform SSH 腻子挑战
【发布时间】:2018-04-22 12:39:43
【问题描述】:

您好,我正在尝试通过 Terraform 自动配置到 EC2 实例。但我的登录永远不会完成。根据我的理解,我应该将我的 AWS PEM 密钥导出到 OpenSSH 等。(脚本中引用的文件)这里是我的基本脚本的关键部分。最终由于某些 SSH 问题导致脚本超时。有人可以给我一些见解,我在哪里错了吗?

connection {
    user        = "ec2-user"
    private_key = "${file("PluralSight_Key_Pair3")}"   }

  provisioner "remote-exec" {
    inline = [
      "sudo yum install nginx -y",
      "sudo service nginx start"
    ]

aws_instance.nginx (remote-exec): Connecting to remote host via SSH... aws_instance.nginx (remote-exec):   Host: 54.88.230.73 aws_instance.nginx (remote-exec):   User: ec2-user aws_instance.nginx (remote-exec):   Password: false aws_instance.nginx (remote-exec):   Private key: true aws_instance.nginx (remote-exec):   SSH Agent: false aws_instance.nginx (remote-exec):   Checking Host Key: false aws_instance.nginx: Still creating... (2m10s elapsed) aws_instance.nginx: Still creating... (2m20s elapsed) aws_instance.nginx: Still creating... (2m30s elapsed) aws_instance.nginx: Still creating... (2m40s elapsed) aws_instance.nginx (remote-exec): Connecting to remote

1 error(s) occurred:

* aws_instance.nginx: timeout - last error: dial tcp 54.88.230.73:22: i/o timeout

【问题讨论】:

    标签: amazon-web-services terraform


    【解决方案1】:

    超时听起来像是网络问题,或者正在等待 SSH 密钥的密码。

    • 确保实例可通过 SSH 从运行 Terraform 的计算机获得。
    • 您可能想要检查实例的安全组,甚至可以在没有配置程序的情况下运行 Terraform,并尝试使用一些调试输出手动连接 (ssh -v)
    • 您可以通过在 terraform apply 命令前面添加 TF_LOG=debug 来获取有关问题的更多信息

    【讨论】:

      猜你喜欢
      • 2018-09-19
      • 2010-10-09
      • 2018-08-10
      • 1970-01-01
      • 1970-01-01
      • 2014-12-21
      • 2018-01-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多