chef-provisioning-aws icon indicating copy to clipboard operation
chef-provisioning-aws copied to clipboard

InvalidInstanceIDNotFound on creating machine_image

Open christinedraper opened this issue 9 years ago • 1 comments

With chef-provisioning-aws 1.4.1 it looks like machine_image isn't waiting until the instance is properly available before trying to create the image. It completes OK on the second chef-client run.

   - Create testappserver-aws1_image with AMI ami-1a1eff29 in us-west-2[2015-10-16T09:36:04-07:00] INFO: Processing chef_node[testappserver-aws1_image] action create (basic_chef_client::block line 57)
[2015-10-16T09:36:04-07:00] INFO: HTTP Request Returned 404 Not Found: Object not found: chefzero://localhost:8889/nodes/testappserver-aws1_image

    - create node testappserver-aws1_image at chefzero://localhost:8889
    -   update chef_environment from "_default" to "test"
    -   add normal.tags = ["test"]
    -   add normal.topo = {"node_type"=>"appserver", "name"=>"inttest1"}
    -   add normal.test_top_level_bool = true
    -   add normal.test_top_level_num = 2
    -   add normal.testapp = {"user"=>"ubuntu", "path"=>"/var/opt", "test_bool"=>false, "test_num"=>5.4, "db_location"=>"172.31.32.63", "test_ref"=>false}
    -   add normal.chef_provisioning = {"reference"=>{"driver_version"=>"1.4.1", "allocated_at"=>"2015-10-16 16:36:04 UTC", "host_node"=>"chefzero://localhost:8889/nodes/", "image_id"=>"ami-1a1eff29", "instance_id"=>"i-52c60496", "key_name"=>"xxxxx", "ssh_username"=>"ubuntu"}, "driver_url"=>"aws:xxxxx"}
    -   update run_list from [] to ["recipe[apt]", "recipe[testapp::appserver]", "recipe[testapp::deploy]"][2015-10-16T09:36:04-07:00] INFO: [Aws::EC2::Client 200 0.113569 0 retries] describe_instances(instance_ids:["i-52c60496"])  

[2015-10-16T09:36:04-07:00] INFO: [Aws::EC2::Client 200 0.128373 0 retries] describe_instances(instance_ids:["i-52c60496"])  

[2015-10-16T09:36:04-07:00] INFO: [Aws::EC2::Client 400 0.085271 0 retries] describe_instances(instance_ids:["i-52c60496"]) Aws::EC2::Errors::InvalidInstanceIDNotFound The instance ID 'i-52c60496' does not exist


    ================================================================================
    Error executing action `create` on resource 'machine_image[testappserver-aws1_image]'
    ================================================================================

    Aws::EC2::Errors::InvalidInstanceIDNotFound

christinedraper avatar Oct 16 '15 16:10 christinedraper

It's possible this only happens in the following case:

  1. Create machine_image (which happens to be used in autoscaling group)
  2. Destroy machine_image and autoscaling group
  3. Recreate machine_image (i.e. rerun same recipe)

christinedraper avatar Oct 16 '15 17:10 christinedraper