right_aws
RightScale Amazon Web Services Ruby Gems
Is there a way to change the permission of every single file in a S3 bucket using either aws-s3 gem or right_aws gem?
I can't find it in the documentation. Do I have to do each file individually?
I would like to grant "everyone" view permission.
Source: (StackOverflow)
Is it possible to the set the name of an EC2 instance with right_aws like I can with the AWS Management Console?
Source: (StackOverflow)
This is a question about ruby RightAws API to Amazon EC2. When we create a new instance of Ec2 by RightAws::Ec2.new, passing region or not, all calls to methods using that instance of ec2 thus created, only talk about things inside that region (or default region), is this right? Or, are there calls which are universal, even while passing an explicit region?
Thanks
Udaya
Source: (StackOverflow)
I have a rails application where I need to implement queuing system in it. Before that I want to see and understand how the queuing system works by creating a dummy rails application.
So I am using ElaticMq with right_aws gem for that purpose.
I need to know how can I call the ElasticMQ from right_aws and create a queue with the help of right_aws gem. From their documentation I could not find any help.
So could you please input some ideas/suggestions for that.
Source: (StackOverflow)
Could you please tell me where do I have to store my AWS access key and secret access key when using Right_aws to access SDB?
Source: (StackOverflow)
I need to find out how to delet a file on my S3 bucket using the right-aws gem (https://github.com/rightscale/right_aws). The current doc (the README at github) isn't very helpful...
Has anyone tried doing something similar and would like to share their findings?
Source: (StackOverflow)
I am trying to grab an image from amazon s3, do some stuff with Rmagick, and upload the image back to s3. I am attempting to do this with right_aws and RMagick/mini_magick. So far i havent had any luck. Imagemagick seems to be installed correctly by testing it with the command line.
Here is what i am currently trying to do:
grab the image with right_aws and store as a RightAws::Key:
s3 = RightAws::S3.new(ID, Secret)
bucket = s3.bucket( 'baneling')
key = RightAws::S3::Key.create(bucket, 'flower.jpg')
Then i am trying to convert the key.data into an Image file. If i try with mini_magick with this code:
image = MiniMagick::Image.read(key.data)
or
image = MiniMagick::Image.read(key.public_link)
#key.public_link is public s3 url to image. i.e. https://s3.amazonaws.com/bucket.flower.jpg
i get this error:
MiniMagick::Invalid: MiniMagick::Invalid
from /home/adnan/.rvm/gems/ruby-1.9.3-p194/gems/mini_magick-3.4/lib/mini_magick.rb:164:in `create'
If i try with RMagick:
Magick::Image.from_blob(key.data)
or
image = Magick::ImageList.new
urlimage = open(key.public_link, 'rb')
image.from_blob(urlimage.read)
i get this error:
Magick::ImageMagickError: no decode delegate for this image format `' @ error/blob.c/BlobToImage/360
Anyone know what I am doing wrong? I tried various images including jpg and png. I am using rails 3.2.3, ruby 1.9.3p194, ubuntu 11.04, right_aws 3.0.4, rmagick 2.13.1, mini_magick 3.4.
Source: (StackOverflow)
I'm using Amazon S3 to host images. The S3 bucket is private, so I generate a temporary URL (using Right AWS) with a 5-minute expiry to allow the image to be rendered. The URL looks like this (note: URL below will not work):
https://mybucket.s3.amazonaws.com:443/attachments%2F30%2Fsmall.png?Signature=J%2BXzQd95myCNv0Re8arMhuTFSvk%3D&Expires=1235511662&AWSAccessKeyId=1K3MW21E6T8LWBY94C01
This works fine, and I can paste the URL into Firefox and the image is displayed. Same for IE. However, when I try it in Safari the URL appears to resolve but no image is displayed. Similarly, if I try and use the URL in the src attribute of an IMG tag on a web page, nothing is rendered by Safari (fine in all other browsers), e.g:

Has anyone seen this behaviour before and can you point out what, if anything, I might be doing wrong?
Source: (StackOverflow)
I have been experimenting with S3 and they have this cool feature where you can set ACL's on the content of a bucket through a bucket policy. So for instance you can have a bunch of files with the actual ACL on the file set to private but the file is made available to certain users / ip addresses / referrers through the overriding policy.
In my case I have a bunch of private content in a bucket but I want to make the files in a particular directory available to my site (e.g. Images). So I have something like this:
{
"Version": "2008-10-17",
"Id": "",
"Statement": [
{
"Sid": "AddPerm",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::content-racket-fm/uploaded/images/*"
}
]
}
Now we have some background I can get to the question. I recently found out here:
https://forums.aws.amazon.com/thread.jspa?threadID=78294
That bucket policies only work for files that are owned by the bucket owner. So for instance if the files ended up in the bucket through some external service like encoding.com or panda stream where they have their own user on your S3 bucket, you're going to have problems because your bucket policy won't be applied to these files (that seems like an oversight by amazon in my opinion but I am sure there is a good reason I haven't thought of)
I am using rails, is there a way to set the owner of an object in a bucket.
Edit
I guess a better question might be...
Is there a way to setup an amazon bucket so it applies bucket policy to all files regardless of owner.
Source: (StackOverflow)
for a new App I want to use paperclip to store Files to S3. I already have installed the aws-s3 gem for another app. That seems to cause some problems, because Paperclip should use right_aws but is trying to use the aws-s3 gem. But I don't want to remove the aws-s3 gem from my system. Is there a way to solve this conflict? Maybe by forcing paperclip to use right_aws? Or by changing the configuration?
My setup
# enviroment.rb
config.gem 'right_aws'
# my model with the attachment
has_attached_file :thumbnail,
:styles => { :thumb => "160x120>" },
:storage => :s3,
:s3_credentials => "#{RAILS_ROOT}/config/amazons3.yml",
:path => ":provider/:attachment/:id_:style.:extension"
# config/amazons3.yml
development:
bucket: bucketname
access_key_id: secret
secret_access_key: secret
test:
bucket: bucketname
access_key_id: secret
secret_access_key: secret
production:
bucket: bucketname
access_key_id: secret
secret_access_key: secret
# The Error in the console
ArgumentError: wrong number of arguments (5 for 4)
from /Library/Ruby/Gems/1.8/gems/right_http_connection-1.2.4/lib/net_fix.rb:85:in `send_request_with_body_stream'
from /Library/Ruby/Gems/1.8/gems/right_http_connection-1.2.4/lib/net_fix.rb:85:in `exec'
from /Library/Ruby/Gems/1.8/gems/right_http_connection-1.2.4/lib/net_fix.rb:144:in `request'
from /Library/Ruby/Gems/1.8/gems/aws-s3-0.6.2/lib/aws/s3/connection.rb:45:in `request'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/http.rb:543:in `start'
from /Library/Ruby/Gems/1.8/gems/aws-s3-0.6.2/lib/aws/s3/connection.rb:52:in `request'
from /Library/Ruby/Gems/1.8/gems/aws-s3-0.6.2/lib/aws/s3/base.rb:69:in `request'
from /Library/Ruby/Gems/1.8/gems/aws-s3-0.6.2/lib/aws/s3/base.rb:88:in `put'
from /Library/Ruby/Gems/1.8/gems/aws-s3-0.6.2/lib/aws/s3/object.rb:241:in `store'
...
Thanks!
Source: (StackOverflow)
I'm trying to use the right_aws (1.10.0) GEM with Rails, and I've reduced my problem to a 3-line irb session. The following works
require 'rubygems'
require 'right_aws'
sqs = RightAws::Sqs.new("xxxxxxxxxxxxxxx", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
while this fails
require 'rubygems'
require 'right_aws'
sqs = RightAws::SqsGen2.new("xxxxxxxxxxxxxxx", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
with NameError: uninitialized constant RightAws::SqsGen2
. I see the class definition in the GEM source, the documentation is old but seems accurate, but I can't figure out what I'm doing wrong.
And while you're at it, is there any reason if I'm building something new, I'd want to use the older interface?
Source: (StackOverflow)
I must use RightAWS for certain things. However, I can only get Paperclip uploads to S3 working when RightAWS is nowhere in my Gemfile. Since v2.3.11, Paperclip has used AWS-S3, switching from RightAWS.
RightAWS allows me to check the existence of an object without downloading the entire object via the head? method. It also allows me to stream massive amounts of files from a bucket in 1,000 unit chunks with its incrementally_list_bucket method. I haven't found a way to duplicate this functionality in AWS-S3. I do not have the time currently to implement this and contribute it either.
Can anyone tell me if there is a way to load both of these AWS gems in a Rails 3 project without causing Paperclip to cause the "wrong number of arguments (4 for 5) error?
Source: (StackOverflow)
The right_aws documentation states:
put(key, data=nil, meta_headers={}, perms=nil, headers={})
Store object data. The key is a String or Key instance. Returns true.
bucket.put('logs/today/1.log', 'Olala!') #=> true
How does this put call match the signature?
To turn on encryption:
...when you are uploading a new object or making a copy of an existing object, you can specify if you want Amazon S3 to encrypt your data by adding the x-amz-server-side-encryption header to the request. Set the value of the header to the encryption algorithm AES256 that Amazon S3 supports
How do you turn on encryption?
Source: (StackOverflow)