I have my terraform configured for AWS. I have automated 2 EC2 Instance and 2 ECS Optimized Instance.
I am getting **Error launching source instance: timeout while waiting for the state to become 'success' (timeout: 15s)**
for all the 4 Instances while I do terraform apply.
I found on some blog that it may be because of inconsistent AMI or misspelled AMI id.
Hence, I have fixed the typo in my AMI id and able to launch 2 instances. However, still, I got the timeout error for the other two instances.
I am using terraform version: 0.9.6 My TF code for ec2 creation:
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"
}
}
Can someone please help me.
Thanks in advance.