Resolve valid image value error

2019-09-06 15:43发布

问题:

I'm trying to create and deploy a PostgreSQL server to AWS using the knife-ec2 gem and chef. In my .chef repository of my project I have the knife.rb file. Here are the contents of that file.

cookbook_path [ 'Users/Petesta/Git/ringbase/chef/cookbooks' ]

knife[:aws_access_key_id] = "randomString"

knife[:aws_secret_access_key] = "randomString"

knife[:aws_ssh_key_id] = "default"

knife[:flavor] = "t1.micro"

knife[:image] = "ami-6aad335a"

knife[:region] = "us-west-1"

knife[:availability_zone] = "us-west-1a"

Let's say my .pem file is named default.pem. I've put the value for the key aws_ssh_key_id as default and default.pem. I was looking around and a post mentioned excluding the .pem extension. But it still produced the same error.

And then when I run the command knife ec2 server create "role[postgresql::server]" I get the error.

Error: You have not provided a valid image (AMI) value. Please note that the short option for this value recently changed from '-i' to '-I'.

I'm not sure what to do. Anyone have any ideas?

I've also tried manually specifying it on the command line.

回答1:

So the issue was that the AMI I was using is not in the same region. The AMI was not in us-west-1 but in us-west-2 and didn't match the value for key region.