chef-boneyard / chef-provisioning-aws

AWS driver and resources for Chef that uses the AWS SDK
Apache License 2.0
142 stars 122 forks source link

Unable to create an Instance on us-east-2 #529

Open catalinvr opened 7 years ago

catalinvr commented 7 years ago

Hi guys,

I'm not able to converge an EC2 instance in US-EAST-2. The instance is created but chef is throws the following error:

undefined method `name' for nil:NilClass on

[2017-03-20T14:26:06+02:00] DEBUG: Re-raising exception: NoMethodError - machine[Ubuntu_Server_14.04_x64_v1.2.4_2017.3.20_EBS_HVM] (my_ubuntu_instance::provisioning_machine line 37) had an error: NoMethodError: undefined method name' for nil:NilClass /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-provisioning-aws-2.1.0/lib/chef/provisioning/aws_driver/driver.rb:1031:indefault_ami_for_criteria' /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-provisioning-aws-2.1.0/lib/chef/provisioning/aws_driver/driver.rb:1042:in default_ami_for_region' /opt/chefdk/embedded/lib/ruby/gems/2.3.0/gems/chef-provisioning-aws-2.1.0/lib/chef/provisioning/aws_driver/driver.rb:856:inbootstrap_options_for'

Here you can find the logfile: http://pastebin.com/k2NLJvfC

cheeragpatel commented 7 years ago

Check your cheffish version, we were also seeing this issue, updating to cheffish 4.1.1 resolved the issue with chef-provisioning-aws 2.1.0.

lovejoey11 commented 6 years ago

I had the same issue before, please check your driver configuration in knife.rb. The driver option should look like

driver 'aws:<profile name>'
driver_options :compute_options => {
                                     :aws_access_key_id => '<key_id>',
                                     :aws_secret_access_key => '<key>',
                                     :region => 'us-east-2'
                                    }

Your recipe dependency declaration. should look like

require 'chef/provisioning'
require 'chef/provisioning/aws_driver'