2016-12-18 51 views
0

我在s3中使用回形針創建的「private」下存儲了數千個項目,我需要從private改爲public。更改存儲在s3中的媒體項目的權限

如何使用aws或paperclip gem來做到這一點?

以下是我基於媒體的信息。

:s3_credentials=>{:bucket=>"minute-production", :access_key_id=>"##", :secret_access_key=>"##"}, :s3_permissions=>:private}, @post_processing=true, @queued_for_delete=[], @queued_for_write={}, @errors={}, @dirty=false, @interpolator=Paperclip::Interpolations, @url_generator=#<Paperclip::UrlGenerator:0x007fcbbc2d3ce8 @attachment=#<Paperclip::Attachment:0x007fcbbc2d3e28 ...>, @attachment_options={:convert_options=>{}, :default_style=>:original, :default_url=>"/:attachment/:style/missing.png", :escape_url=>true, :restricted_characters=>/[&$+,\/:;[email protected]<>\[\]\{\}\|\\\^~%# ]/, :filename_cleaner=>nil, :hash_data=>":class/:attachment/:id/:style/:updated_at", :hash_digest=>"SHA1", :interpolator=>Paperclip::Interpolations, :only_process=>[], :path=>":class/:id/:attachment/:fingerprint-:style.:extension", :preserve_files=>false, :processors=>[:thumbnail], :source_file_options=>{}, :storage=>:s3, :styles=>{}, :url=>":s3_path_url", :url_generator=>Paperclip::UrlGenerator, :use_default_time_zone=>true, :use_timestamp=>false, :whiny=>true, :validate_media_type=>true, :check_validity_before_processing=>true, :s3_protocol=>:https, :s3_host_name=>"s3.amazonaws.com", :s3_region=>"us-east-1", :s3_headers=>{"Cache-Control"=>"max-age=315576000", "Expires"=>"Fri, 18 Dec 2026 07:17:38 GMT"}, :s3_credentials=>{:bucket=>"minute-production", :access_key_id=>"###", :secret_access_key=>"###"}, :s3_permissions=>:private}>, @source_file_options={}, @whiny=true, @s3_options={}, @s3_permissions={:default=>:private}, @s3_protocol=:https, @s3_metadata={}, @s3_headers={:cache_control=>"max-age=315576000", :expires=>"Fri, 18 Dec 2026 07:17:38 GMT"}, @s3_storage_class={:default=>nil}, @s3_server_side_encryption=false, @http_proxy=nil> 

回答

1

如果這是一個一次性的操作你可以使用命令行工具:

aws s3 sync s3://my-bucket/path s3://my-bucket/path --acl public-read 
相關問題