我使用回形宝石在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=>/[&$+,\/:;=?@<>\[\]\{\}\|\\\^~%# ]/, :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>
答案 0 :(得分:1)
如果这是一次性操作,您只需使用命令行工具:
aws s3 sync s3://my-bucket/path s3://my-bucket/path --acl public-read