2012-08-01 64 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]。