Search code examples
amazon-web-servicessshamazon-amipacker

Packer Amazon-EBS builder example build fails: Timeout waiting for SSH


I’m trying to run the Packer amazon-ebs builder example. I modified the template to include vpc, subnet, and security group:

{
  "variables": {
    "aws_access_key": "",
    "aws_secret_key": ""
  },
  "builders": [{
    "vpc_id": "vpc-0d082b1de108c6a62",
    "subnet_id": "subnet-07212687cf82e3342",
    "security_group_id": "sg-03fde06f0b030638b",
    "type": "amazon-ebs",
    "access_key": "{{user `aws_access_key`}}",
    "secret_key": "{{user `aws_secret_key`}}",
    "region": "us-west-2",
    "source_ami": "ami-095cd038eef3e5074",     
    "instance_type": "t2.micro",
    "ssh_username": "ec2-user",
    "ami_name": "pack-lin-noprovisioning {{timestamp}}"
  }]
}

I’m running packer from an instance in the same subnet as the temporary instance that Packer is creating for the ami and all traffic between the two is allowed so I don’t think this is a networking or security issue. The ami is amazon linux.

I can see that the temporary instance fully initializes and stays that way for some time, but the running template just stays stuck at: “Waiting for SSH to become available”... until it finally times out. I’m currently looking for a Packer log file or a way to force Packer to use a specific Key Pair (to rule out the temporary one Packer creates), in the meantime I was hoping that someone here may have run into this and could offer some help?

I did see a similar question to this but the answer given there is not relevant as my network setup is different.

Thank You


Solution

  • I have this working now - Once I found out that I could use: export PACKER_LOG=1 export PACKER_LOG_PATH="packerlog.txt" for Packer logging, I was able to see the IPs Packer was trying to use and adjust my security groups accordingly.