将数据放入s3存储桶时,aws :: KMS :: Errors :: AccessDeniedException

时间:2020-08-13 02:04:54

标签: ruby-on-rails amazon-s3 aws-kms

我已经设置了存储桶,并设置了kms id,尝试访问该存储桶并向其中写入一些测试数据,以某种方式我一直在获取aws :: KMS :: Errors :: AccessDeniedException 这是我写的红宝石代码

  region = 'us-east-1'
  keyId = "arn:aws:kms:us-east-1:xxx:key/xxx"
  kms = aws::KMS::Client.new(region: region)
  client = aws::S3::Encryption::Client.new(
      region: region,
      kms_key_id: keyId,
      kms_client: kms
      )
      
   bucket = "test_bucket"
   item = "test_item"
   contents = "some testing"
    client.put_object(
        body: contents,
      bucket: bucket,
      key: item

0 个答案:

没有答案