简体   繁体   中英

How can I set an S3 Bucket Policy using the ruby gem aws-s3?

I'm trying to set an S3 bucket policy using the aws-s3 gem. However, I'm open to other ways of doing it. I have a raw json string representing the policy.

I've been trying for a while. I know I can do it, just having one of those days.

If anyone knows how, it would be much appreciated.

I recomend using the aws-sdk gem (disclaimer, I am a contributor):

require 'aws-sdk'

AWS.config(:access_key_id => '...', :secret_access_key => '...')
AWS::S3.new.buckets['bucket-name'].policy = json_policy

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM