Sunday 15 June 2014

amazon web services - copying s3 bucket to another aws account with CarrierWave Ruby gem -


I am trying to copy some content from a byte with a bucket in a different AAS account. I am loading the uploader object in a hash, then I tried to connect the other bucket and save the property using credentials for that bucket.

  Tasks: product_color_images = & gt; : Environment CareerWorld Configure | C. C.fog_credentials = {: Provider = & gt; 'AWS' ,: A VS_Acce_KiIID => ENV ['COPY_FROM_AWS_KEY_ID'] ,: aws_secret_access_key = & gt; ENV ['COPY_FROM_AWS_KEY']} c.fog_directory = 'orig-bucket' # image copied from # bucket image_storage = {} productImage.all.each do | Image | Puts 'product image storage' image_storage [image.id] = image.image end carrier Wave.configure do | C | C.reset_config c.fog_credentials = {: Provider = & gt; 'AWS' ,: A VS_Acce_KiIID => ENV ['COPY_TO_AWS_KEY_ID'] ,: aws_secret_access_key = & gt; ENV ['COPY_TO_AWS_KEY']} c.fog_directory = 'target-bucket' # Bucket copied image_storage.Elect | K, v | Image = product image.find (s) image.image = v 'saves product image' image.save end end   

Try saving one image from one bucket to another in the console It is revealed that the target bucket address is not used.

  Ruby-1.9.2-P2902: 026 & gt; Image = Product Image.Fund (197) Ruby-1.9.2-P290: 027 & gt; Image.image = image_storage [1 9 7] = & gt; Http: //orig-bucket.s3.amazonaws.com/uploads/product_image/image/197/product_image.png ruby-1.9.2-p290: 028 & gt; Image.save ruby-1.9.2-p290: 02 9 & gt; Image.image = & gt; Http://orig-bucket.s3.amazonaws.com/uploads/product_image/image/197/product_image.png    

A lot of things happen that the bucket will be allowed enough so that you have enough permissions for images so that you can actually download them.

I have a better solution for you, what can you do to install and configure your S3 CMD and make a receipt between two buckets. He will do things fast, so your Ruby on Rails

No comments:

Post a Comment