2012-08-01 56 views
11

您好我正在试用ec2的橡胶宝石,但有一些问题需要通过快速启动部分。由于某种原因,橡胶下的雾没有找到密钥对。这里是详细信息:橡胶2(雾)和密钥对错误

in irb(这里的路径是我的rubber.yml key_file属性中的内容 - gsg-keypair是我没有pem扩展名的私钥并且它的公钥位于相同目录中):

1.9.3p125 :010 > File.open("#{Dir[(File.expand_path('~') rescue '/root') + '/.ec2/*'].first}") 


=> #<File:/home/charlie/.ec2/gsg-keypair> 

但每次我运行:封口胶:create_staging接受所有默认值,我得到这个:

/home/charlie/.rvm/gems/[email protected]/gems/excon-0.15.4/lib/excon/connection.rb:276:in `request_kernel': The key pair 'gsg-keypair' does not exist (Fog::Compute::AWS::NotFound) 
from /home/charlie/.rvm/gems/[email protected]/gems/excon-0.15.4/lib/excon/connection.rb:105:in `request' 
from /home/charlie/.rvm/gems/[email protected]/gems/fog-1.5.0/lib/fog/core/connection.rb:20:in `request' 
from /home/charlie/.rvm/gems/[email protected]/gems/fog-1.5.0/lib/fog/aws/compute.rb:368:in `request' 
from /home/charlie/.rvm/gems/[email protected]/gems/fog-1.5.0/lib/fog/aws/requests/compute/run_instances.rb:117:in `run_instances' 
from /home/charlie/.rvm/gems/[email protected]/gems/fog-1.5.0/lib/fog/aws/models/compute/server.rb:182:in `save' 
from /home/charlie/.rvm/gems/[email protected]/gems/fog-1.5.0/lib/fog/core/collection.rb:50:in `create' 
from /home/charlie/.rvm/gems/[email protected]/gems/rubber-2.0.5/lib/rubber/cloud/fog.rb:27:in `create_instance' 
from /home/charlie/.rvm/gems/[email protected]/gems/rubber-2.0.5/lib/rubber/thread_safe_proxy.rb:13:in `method_missing' 
from /home/charlie/.rvm/gems/[email protected]/gems/rubber-2.0.5/lib/rubber/recipes/rubber/instances.rb:295:in `create_instance' 
from /home/charlie/.rvm/gems/[email protected]/gems/rubber-2.0.5/lib/rubber/recipes/rubber/instances.rb:215:in `block (2 levels) in create_instances' 

任何想法,为什么这是怎么回事?

感谢 查理

回答

36

我刚刚经历了这一点,这是发生了什么事:

在rubber.yml文件我有:
region: us-east-1

然而,当我建立了我的钥匙在AWS控制台中配对,我在不同的地区。
您必须在与rubber.yml文件中指定的相同区域中创建密钥对。

enter image description here

希望这有助于!

+0

这是有效的。谢谢。 – 2012-08-22 06:03:51

3

在新的AWS界面中,区域位于右上角。选择你所希望的任何区域,只要保证你的config/rubber/rubber.yml文件是准确的:

cloud_providers: 
aws: 
# REQUIRED The AWS region that you want to use. 
# 
# Options include 
#us-east-1 
# eu-west-1 
# ap-northeast-1 
# ap-southeast-1 
# ap-southeast-2 
# 
region: us-east-1 

config/rubber/rubber.yml是完全一样的上面,和它的作品。感谢Johnnycakes解决这个问题!

1

对不起,“重振”旧的问题,但这可能对某人有用。

我有类似的问题,除了我的地区是完全一样的。 我的问题是,我重命名了密钥文件,看起来应该像AWS/EC2/Keypairs中的“密钥对名称”一样命名。

0

我将此行添加到了我的rubber/deploy.rb文件中,并处理了它。此行过去是[默认] launch-wizard-1是我的ec2 aws实例的名称。 add .. assigned_security_groups:[launch-wizard-1]。