Packer: Packer 1.1.3 fails for AWS with 'ResourceNotReady: exceeded wait attempts'

Created on 14 Jan 2018  ยท  3Comments  ยท  Source: hashicorp/packer

I have a CentOS Packer build on AWS which works with version 1.1.2 but fails with version 1.1.3

The template used to build the image (Source AMI ID taken from https://wiki.centos.org/Cloud/AWS)

{
    "builders": [
        {
            "access_key": "{{user `aws_access_key`}}",
            "ami_block_device_mappings": [
                {
                    "device_name": "/dev/sdb",
                    "virtual_name": "ephemeral0"
                },
                {
                    "device_name": "/dev/sdc",
                    "virtual_name": "ephemeral1"
                }
            ],
            "ami_description": "CentOS 7 with updates ({{isotime \"2006-01-02-15-04-05\"}})",
            "ami_name":  "centos7-with-updates-{{isotime \"2006-01-02-15-04-05\"}}",
            "ami_regions": [
                "us-west-2"
            ],
            "ami_users": [
                "XXXXXXXXXXXX"
            ],
            "instance_type": "t2.medium",
            "region": "us-east-1",
            "secret_key": "{{user `aws_secret_key`}}",
            "source_ami": "ami-ae7bfdb8",
            "ssh_username": "centos",
            "type": "amazon-ebs"
        }
    ],
    "post-processors": [
        {
            "inline": [
                "date",
                "exit 0"
            ],
            "type": "shell-local"
        }
    ],
    "provisioners": [
        {
            "inline": [
                "sleep 10",
                "sudo yum -y update",
                "sudo yum -y install unzip vim tree",
                "sudo yum remove -y docker docker-common docker-selinux docker-engine",
                "sudo yum install -y yum-utils device-mapper-persistent-data lvm2",
                "sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo",
                "sudo yum install -y docker-ce",
                "sudo systemctl enable docker",
                "sudo yum clean all",
                "sudo rm -rf /var/cache/yum/",
                "exit 0"
            ],
            "type": "shell"
        }
    ],
    "variables": {
        "aws_access_key": "",
        "aws_secret_key": ""
    }
}

_As you can see, I am not doing anything complicated, just a Docker capable CentOS 7 image._

When the build fails using version 1.1.3, it times out with the following error:

==> amazon-ebs: Waiting for instance (i-xxxxxxxxxxxxxxxxx) to become ready...
==> amazon-ebs: Error waiting for instance (i-xxxxxxxxxxxxxxxxx) to become ready: ResourceNotReady: exceeded wait attempts
  • Packer version from packer version
    1.1.2
    1.1.3
  • Host platform
    Ubuntu 14.04 (but I don't think that should matter)

If I run the about template using v 1.1.2, it works fine. (I tested with 1.10 and 1.1.1 and those works as well)

Regards,
Shantanu

Most helpful comment

Thanks for the ticket. Looks like you found the solution. 1.1.4 will be much faster than 1.1.3.

All 3 comments

Adding ec2:DescribeInstanceStatus has made this work for now, though the startup time is a bit slow.

The details are probably well covered in:
https://github.com/hashicorp/packer/issues/5705
https://github.com/hashicorp/packer/pull/5773

Waiting for v1.1.4 to see if the startup goes down as same as v1.1.2.

Thanks and Regards,
Shantanu

Thanks for the ticket. Looks like you found the solution. 1.1.4 will be much faster than 1.1.3.

I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

Was this page helpful?
0 / 5 - 0 ratings