错误“缺少参数:-l (OptionParser::MissingArgument)”,当引导EC2实例与chef一起时。

时间:2022-02-07 02:25:03

I'm very new to both Chef and AWS, but I'm trying to play around with both. I try to bootstrap an AWS instance with the following:

我对厨师和AWS都很陌生,但我正在努力尝试两者兼顾。我尝试用以下方法引导AWS实例:

knife ec2 server create -I ami-62fd7152 -x ubuntu -f t1.micro --region 'us-west-2'

However, when I check my ec2 server list, the server is not listed, though it is listed in my node list. SSH'ing into my instance and checking my chef logs yields the following, but I'm not sure what to do with the information. What am I doing wrong?

但是,当我检查我的ec2服务器列表时,服务器并没有列出,尽管它在我的节点列表中列出。SSH进入我的实例并检查我的chef日志会得到以下信息,但是我不知道该如何处理这些信息。我做错了什么?

~$ sudo chef-client -l
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/mixlib-cli-1.3.0/lib/mixlib/cli.rb:226:in `parse_options': missing argument: -l (OptionParser::MissingArgument)
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/application.rb:78:in `configure_chef'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/application.rb:65:in `reconfigure'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/application/client.rb:217:in `reconfigure'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/application.rb:71:in `run'
from /opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/bin/chef-client:26:in `<top (required)>'
from /usr/bin/chef-client:23:in `load'
from /usr/bin/chef-client:23:in `<main>'

1 个解决方案

#1


1  

The only thing jumping out at me is you need to specify the AWS key pair that you are using. AWS will prompt you to create one when you create a new server through the AWS console. When your ec2 instance comes up, Amazon places this key in the authorized_key file so that you can ssh into the instance. Knife needs to know what key to use, so that it can use the same key to ssh into the instance and bootstrap it. You can use passwords instead of key pairs, but I don't suggest it. It's generally considered bad practice for security reasons.

在我身上跳出来的唯一一件事是,您需要指定您正在使用的AWS密钥对。当您通过AWS控制台创建新服务器时,AWS将提示您创建一个。当您的ec2实例出现时,Amazon将此密钥放在authorized_key文件中,以便您可以ssh到实例。刀需要知道使用什么键,这样它就可以使用相同的键来ssh到实例并引导它。你可以使用密码而不是密钥对,但我不建议这么做。出于安全考虑,这通常被认为是不好的做法。

The option for ssh keys is '--ssh-key' or '-S'. You don't pass the path to where you have that key locally though. Instead just pass the name you've given it in the AWS console. Hope this helps.

ssh密钥的选项是“-ssh-key”或“-S”。但是,你没有通过路径到你在本地拥有关键字的地方。而是将您在AWS控制台中提供的名称传递给它。希望这个有帮助。

#1


1  

The only thing jumping out at me is you need to specify the AWS key pair that you are using. AWS will prompt you to create one when you create a new server through the AWS console. When your ec2 instance comes up, Amazon places this key in the authorized_key file so that you can ssh into the instance. Knife needs to know what key to use, so that it can use the same key to ssh into the instance and bootstrap it. You can use passwords instead of key pairs, but I don't suggest it. It's generally considered bad practice for security reasons.

在我身上跳出来的唯一一件事是,您需要指定您正在使用的AWS密钥对。当您通过AWS控制台创建新服务器时,AWS将提示您创建一个。当您的ec2实例出现时,Amazon将此密钥放在authorized_key文件中,以便您可以ssh到实例。刀需要知道使用什么键,这样它就可以使用相同的键来ssh到实例并引导它。你可以使用密码而不是密钥对,但我不建议这么做。出于安全考虑,这通常被认为是不好的做法。

The option for ssh keys is '--ssh-key' or '-S'. You don't pass the path to where you have that key locally though. Instead just pass the name you've given it in the AWS console. Hope this helps.

ssh密钥的选项是“-ssh-key”或“-S”。但是,你没有通过路径到你在本地拥有关键字的地方。而是将您在AWS控制台中提供的名称传递给它。希望这个有帮助。