简体   繁体   English

无法使用ec2服务器为澳大利亚地区创建

[英]Can't knife ec2 server create for Australian region

Setting up this service for a client in Australia. 为澳大利亚的客户设置此服务。 Running the below command works for the US default region, when I try for the Australian (ap-southeast-2) region I get an error I can't debug. 运行以下命令适用于美国默认区域,当我尝试使用澳大利亚(ap-southeast-2)区域时,出现无法调试的错误。

knife ec2 server create -G linux,web,database,elasticsearch,redis -I ami-e9e675d3 -f m1.small -i ~/.ec2/myclient.pem -x ubuntu -r 'role[base],role[monitoring],role[app_database_master],role[the_app],role[the_app_task_broker]' -E 'production' -N the-server-3 --region=ap-southeast-2 --availability-zone=ap-southeast-2a --distro=ubuntu12.04-gems --bootstrap-version=11.4.0 -VV

 knife ec2 server create -G linux,web,database,elasticsearch,redis -I ami-e9e675d3 -f m1.small -i ~/.ec2/myclient.pem -x ubuntu -r 'role[base],role[monitoring],role[app_database_master],role[the_app],role[the_app_task_broker]' -E 'production'  -N the-server-3 --region=ap-southeast-2 --availability-zone=ap-southeast-2a --distro=ubuntu12.04-gems --bootstrap-version=11.4.0 -VV
/home/user/.rvm/gems/ruby-2.0.0-p0/gems/excon-0.25.3/lib/excon/middlewares/expects.rb:6:in `response_call': The security group 'redis' does not exist in default VPC 'vpc-ea551283' (Fog::Compute::AWS::NotFound)
    from /home/user/.rvm/gems/ruby-2.0.0-p0/gems/excon-0.25.3/lib/excon/middlewares/response_parser.rb:8:in `response_call'
    from /home/user/.rvm/gems/ruby-2.0.0-p0/gems/excon-0.25.3/lib/excon/connection.rb:349:in `response'
    from /home/user/.rvm/gems/ruby-2.0.0-p0/gems/excon-0.25.3/lib/excon/connection.rb:247:in `request'
    from /home/user/.rvm/gems/ruby-2.0.0-p0/gems/fog-1.14.0/lib/fog/xml/sax_parser_connection.rb:34:in `request'
    from /home/user/.rvm/gems/ruby-2.0.0-p0/gems/fog-1.14.0/lib/fog/core/deprecated/connection.rb:18:in `request'
    from /home/user/.rvm/gems/ruby-2.0.0-p0/gems/fog-1.14.0/lib/fog/aws/compute.rb:385:in `_request'
    from /home/user/.rvm/gems/ruby-2.0.0-p0/gems/fog-1.14.0/lib/fog/aws/compute.rb:380:in `request'
    from /home/user/.rvm/gems/ruby-2.0.0-p0/gems/fog-1.14.0/lib/fog/aws/requests/compute/run_instances.rb:112:in `run_instances'
    from /home/user/.rvm/gems/ruby-2.0.0-p0/gems/fog-1.14.0/lib/fog/aws/models/compute/server.rb:179:in `save'
    from /home/user/.rvm/gems/ruby-2.0.0-p0/gems/fog-1.14.0/lib/fog/core/collection.rb:52:in `create'
    from /home/user/.rvm/gems/ruby-2.0.0-p0/gems/knife-ec2-0.6.4/lib/chef/knife/ec2_server_create.rb:241:in `run'
    from /home/user/.rvm/gems/ruby-2.0.0-p0/gems/chef-11.4.4/lib/chef/knife.rb:460:in `run_with_pretty_exceptions'
    from /home/user/.rvm/gems/ruby-2.0.0-p0/gems/chef-11.4.4/lib/chef/knife.rb:173:in `run'
    from /home/user/.rvm/gems/ruby-2.0.0-p0/gems/chef-11.4.4/lib/chef/application/knife.rb:123:in `run'
    from /home/user/.rvm/gems/ruby-2.0.0-p0/gems/chef-11.4.4/bin/knife:25:in `<top (required)>'
    from /home/user/.rvm/gems/ruby-2.0.0-p0/bin/knife:19:in `load'
    from /home/user/.rvm/gems/ruby-2.0.0-p0/bin/knife:19:in `<main>'
    from /home/user/.rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:in `eval'
    from /home/user/.rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:in `<main>'

Just for fun, I'll remove the security groups all together and rerun: 只是为了好玩,我将所有安全组一起删除并重新运行:

 knife ec2 server create -I ami-e9e675d3 -f m1.small -i ~/.ec2/myclient.pem -x ubuntu -r 'role[base],role[monitoring],role[app_database_master],role[the_app],role[the_app_task_broker]' -E 'production'  -N the-server-3 --region=ap-southeast-2 --availability-zone=ap-southeast-2a --distro=ubuntu12.04-gems --bootstrap-version=11.4.0 -VV
/home/user/.rvm/gems/ruby-2.0.0-p0/gems/excon-0.25.3/lib/excon/middlewares/expects.rb:6:in `response_call': The key pair 'myclient' does not exist (Fog::Compute::AWS::NotFound)
    from /home/user/.rvm/gems/ruby-2.0.0-p0/gems/excon-0.25.3/lib/excon/middlewares/response_parser.rb:8:in `response_call'
    from /home/user/.rvm/gems/ruby-2.0.0-p0/gems/excon-0.25.3/lib/excon/connection.rb:349:in `response'
    from /home/user/.rvm/gems/ruby-2.0.0-p0/gems/excon-0.25.3/lib/excon/connection.rb:247:in `request'
    from /home/user/.rvm/gems/ruby-2.0.0-p0/gems/fog-1.14.0/lib/fog/xml/sax_parser_connection.rb:34:in `request'
    from /home/user/.rvm/gems/ruby-2.0.0-p0/gems/fog-1.14.0/lib/fog/core/deprecated/connection.rb:18:in `request'
    from /home/user/.rvm/gems/ruby-2.0.0-p0/gems/fog-1.14.0/lib/fog/aws/compute.rb:385:in `_request'
    from /home/user/.rvm/gems/ruby-2.0.0-p0/gems/fog-1.14.0/lib/fog/aws/compute.rb:380:in `request'
    from /home/user/.rvm/gems/ruby-2.0.0-p0/gems/fog-1.14.0/lib/fog/aws/requests/compute/run_instances.rb:112:in `run_instances'
    from /home/user/.rvm/gems/ruby-2.0.0-p0/gems/fog-1.14.0/lib/fog/aws/models/compute/server.rb:179:in `save'
    from /home/user/.rvm/gems/ruby-2.0.0-p0/gems/fog-1.14.0/lib/fog/core/collection.rb:52:in `create'
    from /home/user/.rvm/gems/ruby-2.0.0-p0/gems/knife-ec2-0.6.4/lib/chef/knife/ec2_server_create.rb:241:in `run'
    from /home/user/.rvm/gems/ruby-2.0.0-p0/gems/chef-11.4.4/lib/chef/knife.rb:460:in `run_with_pretty_exceptions'
    from /home/user/.rvm/gems/ruby-2.0.0-p0/gems/chef-11.4.4/lib/chef/knife.rb:173:in `run'
    from /home/user/.rvm/gems/ruby-2.0.0-p0/gems/chef-11.4.4/lib/chef/application/knife.rb:123:in `run'
    from /home/user/.rvm/gems/ruby-2.0.0-p0/gems/chef-11.4.4/bin/knife:25:in `<top (required)>'
    from /home/user/.rvm/gems/ruby-2.0.0-p0/bin/knife:19:in `load'
    from /home/user/.rvm/gems/ruby-2.0.0-p0/bin/knife:19:in `<main>'
    from /home/user/.rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:in `eval'
    from /home/user/.rvm/gems/ruby-2.0.0-p0/bin/ruby_noexec_wrapper:14:in `<main>'

it does exist: 它确实存在:

ls ~/.ec2/myclient.pem 
/home/user/.ec2/myclient.pem*

knife ec2 server create -G linux,web,database,elasticsearch,redis -I ami-9c78c0f5 -f m1.small -i ~/.ec2/myclient.pem -x ubuntu -r 'role[base],role[monitoring],role[app_database_master],role[the_app],role[the_app_task_broker]' -E 'production'  -N the-server-test --availability-zone=us-east-1a --distro=ubuntu12.04-gems --bootstrap-version=11.4.0
Instance ID: i-xxxxxxxx
Flavor: m1.small
Image: ami-9c78c0f5
Region: us-east-1
Availability Zone: us-east-1a
Security Groups: linux, web, database, elasticsearch, redis
Tags: {"Name"=>"the-server-test"}
SSH Key: myclient

knife ec2 server list

Instance ID  Name         Public IP     Private IP      Flavor    Image         SSH Key   Security Groups                             State  

i-xxxxxx   the-server-1  xxxx  xxxx  m1.small  ami-9c78c0f5  myclient  web, database, linux, elasticsearch, redis  running

This does show that an existing server is up and running. 这确实表明现有服务器已启动并正在运行。

In addition for my own sanity, I ran the command on the us-east-1a zone and: 除了我自己的理智之外,我还在us-east-1a区域运行了命令,并:

knife ec2 server create -G linux,web,database,elasticsearch,redis -I ami-9c78c0f5 -f m1.small -i ~/.ec2/myclient.pem -x ubuntu -r 'role[base],role[monitoring],role[app_database_master],role[the_app],role[the_app_task_broker]' -E 'production'  -N the-server-test --availability-zone=us-east-1a --distro=ubuntu12.04-gems --bootstrap-version=11.4.0

Instance ID: i-xxxxxxx

Flavor: m1.small

Image: ami-9c78c0f5

Region: us-east-1

Availability Zone: us-east-1a

Security Groups: linux, web, database, elasticsearch, redis

Tags: {"Name"=>"the-server-test"}

SSH Key: myclient

It works. 有用。 So something to do with the new region? 那么与新区域有关吗?

gem list 

*** LOCAL GEMS ***

activesupport (4.0.0, 3.2.14, 3.2.13)
addressable (2.3.5, 2.3.4)
akami (1.2.0)
archive-tar-minitar (0.5.2)
atomic (1.1.12)
berkshelf (2.0.8, 1.4.0)
buff-config (0.3.0)
buff-extensions (0.5.0)
buff-ignore (1.1.0)
buff-ruby_engine (0.1.0)
buff-shell_out (0.1.0)
builder (3.2.2)
bundler (1.3.5)
bundler-unload (1.0.1)
celluloid (0.14.1, 0.13.0)
celluloid-io (0.14.1)
chef (11.4.4)
childprocess (0.3.9)
chozo (0.6.1)
erubis (2.7.0)
excon (0.25.3)
faraday (0.8.8, 0.8.7)
ffi (1.9.0, 1.8.1)
fog (1.14.0)
formatador (0.2.4)
gssapi (1.1.2, 1.0.3)
gyoku (1.1.0)
hashie (2.0.5, 2.0.3)
highline (1.6.19, 1.6.18)
httpclient (2.3.4.1, 2.2.0.2)
httpi (2.1.0, 0.9.7)
hub (1.10.6)
i18n (0.6.4, 0.6.1)
ipaddress (0.8.0)
json (1.8.0, 1.7.7)
knife-ec2 (0.6.4)
little-plugger (1.1.3)
log4r (1.1.10)
logging (1.8.1, 1.6.2)
mime-types (1.23)
mini_portile (0.5.1)
minitar (0.5.4)
minitest (5.0.6, 4.7.5)
mixlib-authentication (1.3.0)
mixlib-cli (1.3.0)
mixlib-config (1.1.2)
mixlib-log (1.6.0)
mixlib-shellout (1.2.0, 1.1.0)
multi_json (1.7.8, 1.7.2)
multipart-post (1.2.0)
net-http-persistent (2.9, 2.8)
net-scp (1.1.2, 1.1.1, 1.0.4)
net-ssh (2.6.8, 2.6.7, 2.2.2)
net-ssh-gateway (1.2.0)
net-ssh-multi (1.2.0, 1.1)
nio4r (0.5.0, 0.4.6)
nokogiri (1.6.0, 1.5.10, 1.5.9)
nori (2.3.0, 1.1.5)
ohai (6.18.0, 6.16.0)
rack (1.5.2)
rake (10.1.0, 10.0.4)
rbzip2 (0.2.0)
rest-client (1.6.7)
retryable (1.3.3, 1.3.2)
ridley (1.5.0, 1.2.5, 0.9.0)
ruby-hmac (0.4.0)
rubygems-bundler (1.2.2, 1.1.1)
rubyntlm (0.3.3, 0.1.1)
rvm (1.11.3.8, 1.11.3.7)
savon (2.3.0, 0.9.5)
solve (0.8.0, 0.4.2)
systemu (2.5.2)
thor (0.18.1)
thread_safe (0.1.2)
timers (1.1.0)
tzinfo (1.0.1, 0.3.37)
uuidtools (2.1.4)
vagrant (1.0.7)
varia_model (0.1.1)
wasabi (3.2.0, 1.0.0)
winrm (1.1.2)
yajl-ruby (1.1.0)

The security group should be configured per VPC . 安全组应按VPC配置。 Are you sure that the VPC you created in that region contains the relevant key-pair and security group? 您确定在该区域中创建的VPC包含相关的密钥对和安全组吗?

Turns out there is a drop down menu I never noticed (needed to use) in the AWS management console. 原来,在AWS管理控制台中有一个我从未注意到(需要使用)的下拉菜单。

  1. Selecting the appropriate region in AWS management console 在AWS管理控制台中选择适当的区域
  2. creating a new key pair, then 创建一个新的密钥对,然后
  3. recreating security groups in the new region, then 在新区域中重新创建安全组,然后
  4. updating knife.rb with knife[:aws_ssh_key_id] = "myclient-au", then 用knife [:aws_ssh_key_id] =“ myclient-au”更新knife.rb,然后
  5. passing -i ~/.ec2/myclient-au.pem 传递-i〜/ .ec2 / myclient-au.pem

and everything started working again. 一切又开始工作了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM