1

所以,我试图让 S3 与 Paperclip 一起工作。我正在使用 Rails 设置 Aws。到目前为止,我已经安装了“aws/s3”gem 并在 AWS 上设置了我的 access_keys。

然后我将密钥添加到 s3.yml 文件中:

# config/s3.yml
access_key_id: ******************
secret_access_key: ******************

接下来我跑了:

2.0.0p195 :015 > require 'aws/s3'
 => false 

2.0.0p195 :016 > AWS::S3::Base.establish_connection!(YAML.load_file('config/s3.yml').symbolize_keys!)
 => #<AWS::S3::Connection:0x007feb03ab2bd8 @options={:server=>"s3.amazonaws.com", :port=>80, :access_key_id=>"******************", :secret_access_key=>"******************"}, @access_key_id="*****************", @secret_access_key="******************", @http=#<Net::HTTP s3.amazonaws.com:80 open=false>> 

2.0.0p195 :017 > AWS::S3::Bucket.create('****')
=> AWS::S3::BucketAlreadyOwnedByYou: Your previous request to create the named bucket succeeded and you already own it.
    from /usr/local/rvm/gems/ruby-2.0.0-p195/gems/aws-s3-0.6.3/lib/aws/s3/error.rb:38:in `raise'
    from /usr/local/rvm/gems/ruby-2.0.0-p195/gems/aws-s3-0.6.3/lib/aws/s3/base.rb:72:in `request'
    from /usr/local/rvm/gems/ruby-2.0.0-p195/gems/aws-s3-0.6.3/lib/aws/s3/base.rb:88:in `put'
    from /usr/local/rvm/gems/ruby-2.0.0-p195/gems/aws-s3-0.6.3/lib/aws/s3/bucket.rb:79:in `create'
    from (irb):17
    from /usr/local/rvm/gems/ruby-2.0.0-p195/gems/railties-4.0.0/lib/rails/commands/console.rb:90:in `start'
    from /usr/local/rvm/gems/ruby-2.0.0-p195/gems/railties-4.0.0/lib/rails/commands/console.rb:9:in `start'
    from /usr/local/rvm/gems/ruby-2.0.0-p195/gems/railties-4.0.0/lib/rails/commands.rb:64:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'
2.0.0p195 :018 > 

我不知道它是否有效,或者下一步该做什么。我将此作为指导方针,但我的结果看起来不同。我究竟做错了什么?

4

1 回答 1

0

您的存储桶似乎已经创建,您可以尝试创建一个不同名称的存储桶

于 2013-07-31T23:56:59.580 回答