无法使用AWS Ruby SDK创建s3存储桶

时间:2019-04-14 17:38:22

标签: ruby amazon-web-services amazon-s3

因此,我试图编写一个简单的脚本以连接到AWS s3并创建存储桶,但我不断得到Access Denied (Aws::S3::Errors::AccessDenied)

这是我的代码

require 'aws-sdk'
require 'csv'

def test()
    creds = CSV.read('accessKeys.csv')
    s3_client = Aws::S3::Client.new(
        region: 'us-west-2',
        credentials: Aws::Credentials.new(creds[1][0], creds[1][1]),
    )      
    s3 = Aws::S3::Resource.new(client: s3_client)

    s3.create_bucket({
        bucket: "dns-complaint-bucket",
    })
end

test()

我还向我使用的IAM用户附加了AmazonS3FullAccess策略。

0 个答案:

没有答案