Chef infra 无法从chef workstation创建EC2实例

Chef infra 无法从chef workstation创建EC2实例,chef-infra,chef-workstation,Chef Infra,Chef Workstation,到目前为止,我已经成功地安装了Chef服务器,Chef--manage(UI位),并进行了刀ssl检查 现在,我运行下面的命令 knife ec2 server create -r 'role[webserver]' -I ami-0970010f37c4f9c8d -f t2.micro --region ap-southeast-2 我在knife.rb文件中保存了我的访问密钥和密钥,如下所示: # See https://docs.getchef.com/config_rb_knife.

到目前为止,我已经成功地安装了Chef服务器,Chef--manage(UI位),并进行了
刀ssl检查

现在,我运行下面的命令

knife ec2 server create -r 'role[webserver]' -I ami-0970010f37c4f9c8d -f t2.micro --region ap-southeast-2
我在knife.rb文件中保存了我的访问密钥和密钥,如下所示:

# See https://docs.getchef.com/config_rb_knife.html for more information on knife configuration options

current_dir = File.dirname(__FILE__)
log_level                :info
log_location             STDOUT
node_name                "tuser"
client_key               "#{current_dir}/tuser.pem"
chef_server_url          "https://3.227.234.41/organizations/testdemo"
cookbook_path            ["#{current_dir}/../cookbooks"]
knife[:aws_access_key_id] = "XXXXXXXXXXXXXX"
knife[:aws_secret_access_key] = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
不幸的是,我得到以下错误:

INFO: Using configuration from C:/Users/hp/.chef/knife.rb
DEBUG: Checking if we need to accept Chef license to bootstrap node
DEBUG: Reading products and relationships...
DEBUG: Successfully read products and relationships
DEBUG: License acceptance required for chef version: 15
DEBUG: Searching for the following licenses: ["infra-client", "inspec"]
DEBUG: Found license chef_infra_client at C:/Users/hp/.chef/accepted_licenses/chef_infra_client
DEBUG: Found license inspec at C:/Users/hp/.chef/accepted_licenses/inspec
DEBUG: Missing licenses remaining: []
DEBUG: All licenses present
DEBUG: Using AWS region ap-southeast-2
DEBUG: Setting up AWS connection using aws_access_key_id: AKIAXXXXXXXXXXXXXXXX aws_secret_access_key: cW0YXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX aws_session_token:
Traceback (most recent call last):
        10: from C:/opscode/chef-workstation/bin/knife:383:in `<main>'
         9: from C:/opscode/chef-workstation/bin/knife:383:in `load'
         8: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.10.12-universal-mingw32/bin/knife:24:in `<top (required)>'
         7: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.10.12-universal-mingw32/lib/chef/application/knife.rb:163:in `run'
         6: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.10.12-universal-mingw32/lib/chef/knife.rb:229:in `run'
         5: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.10.12-universal-mingw32/lib/chef/knife.rb:485:in `run_with_pretty_exceptions'
         4: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.10.12-universal-mingw32/lib/chef/local_mode.rb:42:in `with_server_connectivity'
         3: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.10.12-universal-mingw32/lib/chef/knife.rb:486:in `block in run_with_pretty_exceptions'
         2: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.10.12-universal-mingw32/lib/chef/knife/bootstrap.rb:566:in `run'
         1: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/knife-ec2-1.0.36/lib/chef/knife/ec2_server_create.rb:594:in `plugin_validate_options!'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/knife-ec2-1.0.36/lib/chef/knife/ec2_server_create.rb:1185:in `create_key_pair': undefined method `delete' for nil:NilClass (NoMethodError)
错误输出:

INFO: Using configuration from C:/Users/hp/.chef/knife.rb
DEBUG: Checking if we need to accept Chef license to bootstrap node
DEBUG: Reading products and relationships...
DEBUG: Successfully read products and relationships
DEBUG: License acceptance required for chef version: 15
DEBUG: Searching for the following licenses: ["infra-client", "inspec"]
DEBUG: Found license chef_infra_client at C:/Users/hp/.chef/accepted_licenses/chef_infra_client
DEBUG: Found license inspec at C:/Users/hp/.chef/accepted_licenses/inspec
DEBUG: Missing licenses remaining: []
DEBUG: All licenses present
DEBUG: Using AWS region ap-southeast-2
DEBUG: Setting up AWS connection using aws_access_key_id: AKIAXXXXXXXXXXXXXXXX aws_secret_access_key: cW0YXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX aws_session_token:
Traceback (most recent call last):
        10: from C:/opscode/chef-workstation/bin/knife:383:in `<main>'
         9: from C:/opscode/chef-workstation/bin/knife:383:in `load'
         8: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.10.12-universal-mingw32/bin/knife:24:in `<top (required)>'
         7: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.10.12-universal-mingw32/lib/chef/application/knife.rb:163:in `run'
         6: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.10.12-universal-mingw32/lib/chef/knife.rb:229:in `run'
         5: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.10.12-universal-mingw32/lib/chef/knife.rb:485:in `run_with_pretty_exceptions'
         4: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.10.12-universal-mingw32/lib/chef/local_mode.rb:42:in `with_server_connectivity'
         3: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.10.12-universal-mingw32/lib/chef/knife.rb:486:in `block in run_with_pretty_exceptions'
         2: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.10.12-universal-mingw32/lib/chef/knife/bootstrap.rb:566:in `run'
         1: from C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/knife-ec2-1.0.36/lib/chef/knife/ec2_server_create.rb:594:in `plugin_validate_options!'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/knife-ec2-1.0.36/lib/chef/knife/ec2_server_create.rb:1185:in `create_key_pair': undefined method `delete' for nil:NilClass (NoMethodError)
输出:

PS C:\Users\hp\chef-repo> knife ec2 server create -I ami-0970010f37c4f9c8d -f t2.micro --region ap-southeast-2 -S Test2AWS.pem -VVV
INFO: Using configuration from C:/Users/hp/.chef/knife.rb
DEBUG: Checking if we need to accept Chef license to bootstrap node
DEBUG: Reading products and relationships...
DEBUG: Successfully read products and relationships
DEBUG: License acceptance required for chef version: 15
DEBUG: Searching for the following licenses: ["infra-client", "inspec"]
DEBUG: Found license chef_infra_client at C:/Users/hp/.chef/accepted_licenses/chef_infra_client
DEBUG: Found license inspec at C:/Users/hp/.chef/accepted_licenses/inspec
DEBUG: Missing licenses remaining: []
DEBUG: All licenses present
DEBUG: Using AWS region ap-southeast-2
DEBUG: Setting up AWS connection using aws_access_key_id: AKIAXXXXXXXXXXXXXXXX aws_secret_access_key: cW0YXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX aws_session_token:
ERROR: The key pair 'Test2AWS.pem' does not exist
DEBUG: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/aws-sdk-core-3.94.1/lib/seahorse/client/plugins/raise_response_errors.rb:15:in `call'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/aws-sdk-core-3.94.1/lib/aws-sdk-core/plugins/jsonvalue_converter.rb:20:in `call'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/aws-sdk-core-3.94.1/lib/aws-sdk-core/plugins/idempotency_token.rb:17:in `call'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/aws-sdk-core-3.94.1/lib/aws-sdk-core/plugins/param_converter.rb:24:in `call'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/aws-sdk-core-3.94.1/lib/aws-sdk-core/plugins/response_paging.rb:10:in `call'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/aws-sdk-core-3.94.1/lib/seahorse/client/plugins/response_target.rb:23:in `call'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/aws-sdk-core-3.94.1/lib/seahorse/client/request.rb:70:in `send_request'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/aws-sdk-ec2-1.156.0/lib/aws-sdk-ec2/client.rb:35503:in `run_instances'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/knife-ec2-1.0.36/lib/chef/knife/ec2_server_create.rb:995:in `create_ec2_instance'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/knife-ec2-1.0.36/lib/chef/knife/ec2_server_create.rb:321:in `plugin_create_instance!'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.10.12-universal-mingw32/lib/chef/knife/bootstrap.rb:571:in `run'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.10.12-universal-mingw32/lib/chef/knife.rb:486:in `block in run_with_pretty_exceptions'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.10.12-universal-mingw32/lib/chef/local_mode.rb:42:in `with_server_connectivity'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.10.12-universal-mingw32/lib/chef/knife.rb:485:in `run_with_pretty_exceptions'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.10.12-universal-mingw32/lib/chef/knife.rb:229:in `run'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.10.12-universal-mingw32/lib/chef/application/knife.rb:163:in `run'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.10.12-universal-mingw32/bin/knife:24:in `<top (required)>'
C:/opscode/chef-workstation/bin/knife:383:in `load'
C:/opscode/chef-workstation/bin/knife:383:in `<main>'
PS>knife ec2 server create  -r 'role[webserver]' -I ami-0970010f37c4f9c8d -f t2.micro --region ap-southeast-2 -S Test2AWS -i Test2AWS.pem --connection-user ec2-user -VVV
INFO: Using configuration from C:/Users/hp/.chef/knife.rb
DEBUG: Checking if we need to accept Chef license to bootstrap node
DEBUG: Reading products and relationships...
DEBUG: Successfully read products and relationships
DEBUG: License acceptance required for chef version: 15
DEBUG: Searching for the following licenses: ["infra-client", "inspec"]
DEBUG: Found license chef_infra_client at C:/Users/hp/.chef/accepted_licenses/chef_infra_client
DEBUG: Found license inspec at C:/Users/hp/.chef/accepted_licenses/inspec
DEBUG: Missing licenses remaining: []
DEBUG: All licenses present
DEBUG: Using AWS region ap-southeast-2
DEBUG: Setting up AWS connection using aws_access_key_id: AKIAXXXXXXXXXXXXXXXX aws_secret_access_key: cW0YXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX aws_session_token:

Waiting for EC2 to create the instance
Instance ID: i-05d0c4bda0435e609
Flavor: t2.micro
Image: ami-0970010f37c4f9c8d
Region: ap-southeast-2
Availability Zone: ap-southeast-2b
AWS Tags: Name: i-05d0c4bda0435e609
SSH Key: Test2AWS
T2/T3 Unlimited: Disabled

Public DNS Name: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
Public IP Address: 13.211.81.106
Private DNS Name: ip-172-31-12-62.ap-southeast-2.compute.internal
Private IP Address: 172.31.12.62

Waiting for sshd access to become available
SSH Target Address: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com(public_dns_name)
DEBUG: No ssh gateway found, making a direct connection
DEBUG: ssh timed out: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
.DEBUG: ssh timed out: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
.DEBUG: ssh timed out: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
.DEBUG: ssh timed out: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
.DEBUG: ssh timed out: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
.DEBUG: ssh timed out: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
.DEBUG: ssh timed out: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
.DEBUG: ssh timed out: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
.DEBUG: ssh timed out: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
.DEBUG: ssh timed out: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
.DEBUG: ssh timed out: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
.DEBUG: ssh timed out: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
.DEBUG: ssh timed out: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
迭代3:使用命令

命令:

PS C:\Users\hp\chef-repo> knife ec2 server create -I ami-0970010f37c4f9c8d -f t2.micro --region ap-southeast-2 -S Test2AWS.pem -VVV
INFO: Using configuration from C:/Users/hp/.chef/knife.rb
DEBUG: Checking if we need to accept Chef license to bootstrap node
DEBUG: Reading products and relationships...
DEBUG: Successfully read products and relationships
DEBUG: License acceptance required for chef version: 15
DEBUG: Searching for the following licenses: ["infra-client", "inspec"]
DEBUG: Found license chef_infra_client at C:/Users/hp/.chef/accepted_licenses/chef_infra_client
DEBUG: Found license inspec at C:/Users/hp/.chef/accepted_licenses/inspec
DEBUG: Missing licenses remaining: []
DEBUG: All licenses present
DEBUG: Using AWS region ap-southeast-2
DEBUG: Setting up AWS connection using aws_access_key_id: AKIAXXXXXXXXXXXXXXXX aws_secret_access_key: cW0YXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX aws_session_token:
ERROR: The key pair 'Test2AWS.pem' does not exist
DEBUG: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/aws-sdk-core-3.94.1/lib/seahorse/client/plugins/raise_response_errors.rb:15:in `call'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/aws-sdk-core-3.94.1/lib/aws-sdk-core/plugins/jsonvalue_converter.rb:20:in `call'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/aws-sdk-core-3.94.1/lib/aws-sdk-core/plugins/idempotency_token.rb:17:in `call'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/aws-sdk-core-3.94.1/lib/aws-sdk-core/plugins/param_converter.rb:24:in `call'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/aws-sdk-core-3.94.1/lib/aws-sdk-core/plugins/response_paging.rb:10:in `call'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/aws-sdk-core-3.94.1/lib/seahorse/client/plugins/response_target.rb:23:in `call'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/aws-sdk-core-3.94.1/lib/seahorse/client/request.rb:70:in `send_request'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/aws-sdk-ec2-1.156.0/lib/aws-sdk-ec2/client.rb:35503:in `run_instances'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/knife-ec2-1.0.36/lib/chef/knife/ec2_server_create.rb:995:in `create_ec2_instance'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/knife-ec2-1.0.36/lib/chef/knife/ec2_server_create.rb:321:in `plugin_create_instance!'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.10.12-universal-mingw32/lib/chef/knife/bootstrap.rb:571:in `run'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.10.12-universal-mingw32/lib/chef/knife.rb:486:in `block in run_with_pretty_exceptions'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.10.12-universal-mingw32/lib/chef/local_mode.rb:42:in `with_server_connectivity'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.10.12-universal-mingw32/lib/chef/knife.rb:485:in `run_with_pretty_exceptions'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.10.12-universal-mingw32/lib/chef/knife.rb:229:in `run'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.10.12-universal-mingw32/lib/chef/application/knife.rb:163:in `run'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.10.12-universal-mingw32/bin/knife:24:in `<top (required)>'
C:/opscode/chef-workstation/bin/knife:383:in `load'
C:/opscode/chef-workstation/bin/knife:383:in `<main>'
PS>knife ec2 server create  -r 'role[webserver]' -I ami-0970010f37c4f9c8d -f t2.micro --region ap-southeast-2 -S Test2AWS -i Test2AWS.pem --connection-user ec2-user -VVV
INFO: Using configuration from C:/Users/hp/.chef/knife.rb
DEBUG: Checking if we need to accept Chef license to bootstrap node
DEBUG: Reading products and relationships...
DEBUG: Successfully read products and relationships
DEBUG: License acceptance required for chef version: 15
DEBUG: Searching for the following licenses: ["infra-client", "inspec"]
DEBUG: Found license chef_infra_client at C:/Users/hp/.chef/accepted_licenses/chef_infra_client
DEBUG: Found license inspec at C:/Users/hp/.chef/accepted_licenses/inspec
DEBUG: Missing licenses remaining: []
DEBUG: All licenses present
DEBUG: Using AWS region ap-southeast-2
DEBUG: Setting up AWS connection using aws_access_key_id: AKIAXXXXXXXXXXXXXXXX aws_secret_access_key: cW0YXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX aws_session_token:

Waiting for EC2 to create the instance
Instance ID: i-05d0c4bda0435e609
Flavor: t2.micro
Image: ami-0970010f37c4f9c8d
Region: ap-southeast-2
Availability Zone: ap-southeast-2b
AWS Tags: Name: i-05d0c4bda0435e609
SSH Key: Test2AWS
T2/T3 Unlimited: Disabled

Public DNS Name: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
Public IP Address: 13.211.81.106
Private DNS Name: ip-172-31-12-62.ap-southeast-2.compute.internal
Private IP Address: 172.31.12.62

Waiting for sshd access to become available
SSH Target Address: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com(public_dns_name)
DEBUG: No ssh gateway found, making a direct connection
DEBUG: ssh timed out: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
.DEBUG: ssh timed out: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
.DEBUG: ssh timed out: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
.DEBUG: ssh timed out: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
.DEBUG: ssh timed out: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
.DEBUG: ssh timed out: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
.DEBUG: ssh timed out: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
.DEBUG: ssh timed out: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
.DEBUG: ssh timed out: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
.DEBUG: ssh timed out: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
.DEBUG: ssh timed out: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
.DEBUG: ssh timed out: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
.DEBUG: ssh timed out: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
输出:

PS C:\Users\hp\chef-repo> knife ec2 server create -I ami-0970010f37c4f9c8d -f t2.micro --region ap-southeast-2 -S Test2AWS.pem -VVV
INFO: Using configuration from C:/Users/hp/.chef/knife.rb
DEBUG: Checking if we need to accept Chef license to bootstrap node
DEBUG: Reading products and relationships...
DEBUG: Successfully read products and relationships
DEBUG: License acceptance required for chef version: 15
DEBUG: Searching for the following licenses: ["infra-client", "inspec"]
DEBUG: Found license chef_infra_client at C:/Users/hp/.chef/accepted_licenses/chef_infra_client
DEBUG: Found license inspec at C:/Users/hp/.chef/accepted_licenses/inspec
DEBUG: Missing licenses remaining: []
DEBUG: All licenses present
DEBUG: Using AWS region ap-southeast-2
DEBUG: Setting up AWS connection using aws_access_key_id: AKIAXXXXXXXXXXXXXXXX aws_secret_access_key: cW0YXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX aws_session_token:
ERROR: The key pair 'Test2AWS.pem' does not exist
DEBUG: C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/aws-sdk-core-3.94.1/lib/seahorse/client/plugins/raise_response_errors.rb:15:in `call'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/aws-sdk-core-3.94.1/lib/aws-sdk-core/plugins/jsonvalue_converter.rb:20:in `call'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/aws-sdk-core-3.94.1/lib/aws-sdk-core/plugins/idempotency_token.rb:17:in `call'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/aws-sdk-core-3.94.1/lib/aws-sdk-core/plugins/param_converter.rb:24:in `call'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/aws-sdk-core-3.94.1/lib/aws-sdk-core/plugins/response_paging.rb:10:in `call'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/aws-sdk-core-3.94.1/lib/seahorse/client/plugins/response_target.rb:23:in `call'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/aws-sdk-core-3.94.1/lib/seahorse/client/request.rb:70:in `send_request'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/aws-sdk-ec2-1.156.0/lib/aws-sdk-ec2/client.rb:35503:in `run_instances'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/knife-ec2-1.0.36/lib/chef/knife/ec2_server_create.rb:995:in `create_ec2_instance'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/knife-ec2-1.0.36/lib/chef/knife/ec2_server_create.rb:321:in `plugin_create_instance!'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.10.12-universal-mingw32/lib/chef/knife/bootstrap.rb:571:in `run'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.10.12-universal-mingw32/lib/chef/knife.rb:486:in `block in run_with_pretty_exceptions'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.10.12-universal-mingw32/lib/chef/local_mode.rb:42:in `with_server_connectivity'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.10.12-universal-mingw32/lib/chef/knife.rb:485:in `run_with_pretty_exceptions'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.10.12-universal-mingw32/lib/chef/knife.rb:229:in `run'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.10.12-universal-mingw32/lib/chef/application/knife.rb:163:in `run'
C:/opscode/chef-workstation/embedded/lib/ruby/gems/2.6.0/gems/chef-15.10.12-universal-mingw32/bin/knife:24:in `<top (required)>'
C:/opscode/chef-workstation/bin/knife:383:in `load'
C:/opscode/chef-workstation/bin/knife:383:in `<main>'
PS>knife ec2 server create  -r 'role[webserver]' -I ami-0970010f37c4f9c8d -f t2.micro --region ap-southeast-2 -S Test2AWS -i Test2AWS.pem --connection-user ec2-user -VVV
INFO: Using configuration from C:/Users/hp/.chef/knife.rb
DEBUG: Checking if we need to accept Chef license to bootstrap node
DEBUG: Reading products and relationships...
DEBUG: Successfully read products and relationships
DEBUG: License acceptance required for chef version: 15
DEBUG: Searching for the following licenses: ["infra-client", "inspec"]
DEBUG: Found license chef_infra_client at C:/Users/hp/.chef/accepted_licenses/chef_infra_client
DEBUG: Found license inspec at C:/Users/hp/.chef/accepted_licenses/inspec
DEBUG: Missing licenses remaining: []
DEBUG: All licenses present
DEBUG: Using AWS region ap-southeast-2
DEBUG: Setting up AWS connection using aws_access_key_id: AKIAXXXXXXXXXXXXXXXX aws_secret_access_key: cW0YXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX aws_session_token:

Waiting for EC2 to create the instance
Instance ID: i-05d0c4bda0435e609
Flavor: t2.micro
Image: ami-0970010f37c4f9c8d
Region: ap-southeast-2
Availability Zone: ap-southeast-2b
AWS Tags: Name: i-05d0c4bda0435e609
SSH Key: Test2AWS
T2/T3 Unlimited: Disabled

Public DNS Name: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
Public IP Address: 13.211.81.106
Private DNS Name: ip-172-31-12-62.ap-southeast-2.compute.internal
Private IP Address: 172.31.12.62

Waiting for sshd access to become available
SSH Target Address: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com(public_dns_name)
DEBUG: No ssh gateway found, making a direct connection
DEBUG: ssh timed out: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
.DEBUG: ssh timed out: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
.DEBUG: ssh timed out: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
.DEBUG: ssh timed out: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
.DEBUG: ssh timed out: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
.DEBUG: ssh timed out: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
.DEBUG: ssh timed out: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
.DEBUG: ssh timed out: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
.DEBUG: ssh timed out: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
.DEBUG: ssh timed out: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
.DEBUG: ssh timed out: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
.DEBUG: ssh timed out: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
.DEBUG: ssh timed out: ec2-13-211-81-106.ap-southeast-2.compute.amazonaws.com
注意:我没有任何角色,我只是在命令行上使用单个命令。我对厨师很陌生


你知道是什么问题吗?此外,我们可以像Ansible中那样使用yaml文件来代替命令行吗?

错误报告如下:

ec2_server_create.rb:1185:“创建密钥对”中:

您还应该指定ssh到EC2的密钥对,如下所示:

knife ec2服务器创建-r'role[webserver]'-I ami-0970010f37c4f9c8d-f t2.micro--区域ap-souther-2-S-I--ssh用户

这是AWS的ssh密钥对吗?这是我们从AWS下载的pem文件?或者这是我们从Chef服务器下载的用户pem文件?我很困惑,所以我很感激一些指导。从AWS到ssh的pem文件进入EC2,您将创建。-S KEY,--ssh KEY-KEY亚马逊EC2环境的ssh KEY。先生,我尝试了--ssh KEY或-S选项,但没有成功。有什么建议吗?您正在运行以下命令:knife ec2 server create-r'role[webserver]'-I ami-0970010f37c4f9c8d-f t2.micro--region ap-southeast-2-S-I--ssh user