【发布时间】:2017-08-04 04:01:05
【问题描述】:
我为 AWS 配置了 terraform。我已经自动化了 2 个 EC2 实例和 2 个 ECS 优化实例。
当我申请 terraform 时,所有 4 个实例都会收到 **Error launching source instance: timeout while waiting for the state to become 'success' (timeout: 15s)**。
我在一些博客上发现这可能是因为 AMI 不一致或 AMI id 拼写错误。
因此,我已修复了我的 AMI id 中的错字并能够启动 2 个实例。但是,我仍然收到其他两个实例的超时错误。
我使用的是 terraform 版本:0.9.6 我创建 ec2 的 TF 代码:
resource "aws_instance" "node1" {
# ECS-optimized AMI for us-west-2
ami = "ami-62d35c02"
instance_type = "t2.medium"
availability_zone = "us-west-2a"
security_groups = [
"${aws_security_group.sg.name}"
]
key_name = "key"
tags {
Name = "Node Server 1"
}
user_data = <<EOF
#!/bin/bash
echo ECS_CLUSTER=uat >> /etc/ecs/ecs.config
EOF
iam_instance_profile = "${aws_iam_instance_profile.ecs.name}"
}
resource "aws_instance" "node2" {
# ECS-optimized AMI for us-west-2
ami = "ami-62d35c02"
instance_type = "t2.medium"
availability_zone = "us-west-2b"
security_groups = [
"${aws_security_group.sg.name}"
]
key_name = "key"
tags {
Name = "Node Server 2"
}
user_data = <<EOF
#!/bin/bash
echo ECS_CLUSTER=uat >> /etc/ecs/ecs.config
EOF
iam_instance_profile = "${aws_iam_instance_profile.ecs.name}"
}
resource "aws_instance" "mongo" {
ami = "ami-63ad4b1b"
instance_type = "t2.medium"
availability_zone = "us-west-2c"
security_groups = [
"${aws_security_group.sg.name}"
]
key_name = "key"
tags {
Name = "MongoDB Server"
}
}
resource "aws_instance" "mysql" {
ami = "ami-22ac4a5a"
instance_type = "t2.medium"
availability_zone = "us-west-2c"
security_groups = [
"${aws_security_group.sg.name}"
]
key_name = "key"
tags {
Name = "MySQL Server"
}
}
谁能帮帮我。
提前致谢。
【问题讨论】:
-
请出示您的实际地形代码
-
@RaGe 我已经更新了问题中的代码。请看一下。我在错误发生前几次更改了 AMI id。这会是个问题吗?
标签: amazon-web-services amazon-ec2 amazon terraform