尝试按照railscast教程部署到amazon ec2

时间:2013-03-21 01:09:43

标签: ruby-on-rails amazon-ec2 capistrano rubber

我一直在关注这个railscast教程,我很确定我正确地遵循了所有步骤但是当我去运行cap rubber时:create_staging我收到以下错误。

不确定从哪里开始调试。

 The key pair 'gsg-keypair' does not exist (Fog::Compute::AWS::NotFound)
    from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/excon-0.20.1/lib/excon/connection.rb:332:in `response'
    from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/excon-0.20.1/lib/excon/connection.rb:226:in `request'
    from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/fog-1.10.0/lib/fog/core/connection.rb:21:in `request'
    from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/fog-1.10.0/lib/fog/aws/compute.rb:384:in `_request'
    from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/fog-1.10.0/lib/fog/aws/compute.rb:379:in `request'
    from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/fog-1.10.0/lib/fog/aws/requests/compute/run_instances.rb:119:in `run_instances'
    from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/fog-1.10.0/lib/fog/aws/models/compute/server.rb:173:in `save'
    from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/fog-1.10.0/lib/fog/core/collection.rb:52:in `create'
    from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/rubber-2.2.4/lib/rubber/cloud/fog.rb:27:in `create_instance'
    from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/rubber-2.2.4/lib/rubber/thread_safe_proxy.rb:13:in `method_missing'
    from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/rubber-2.2.4/lib/rubber/recipes/rubber/instances.rb:310:in `create_instance'
    from /Users/anderskitson/.rbenv/versions/1.9.3-p374/lib/ruby/gems/1.9.1/gems/rubber-2.2.4/lib/rubber/recipes/rubber/instances.rb:230:in `block (2 levels) in create_instances' 

2 个答案:

答案 0 :(得分:0)

它说无法找到你的'gsg-keypair',回到视频的部分,它教你如何从亚马逊保存gsg-keypair以及在你的根目录中将mkdir保存在哪里。

答案 1 :(得分:0)

您需要创建虚拟实例。然后下载密钥对(例如xyz.pem)文件并按照这些命令进行操作。

$ mkdir ~/.ec2
$ mv ~/Downloads/xyz.pem ~/.ec2/xyz
$ chmod 600 ~/.ec2/xyz

制作公钥版本 -

$ ssh-keygen -y -f ~/.ec2/xyz > ~/.ec2/xyz.pub

然后转到config / rubber / rubber.yml并将key_name更改为此

key_name: xyz
key_file: "#{Dir[(File.expand_path('~') rescue '/root') + '/.ec2/*' + cloud_providers.aws.key_name].first}"

希望这可以解决您的问题。