因此,我试图编写一个简单的脚本以连接到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
策略。