I'm trying to test the aws-s3 gem for ruby, but I'm getting a weird reply:
I connect, and can see I am connected, then I run: AWS::S3::Service.buckets and get the [] reply as expected, then I create a bucket AWS::S3::Bucket.create('some-name') and get true as a reply, then I run AWS::S3::Service.buckets but sti开发者_StackOverflowll get the empty array as an answer?
A quick follow up, since I've had this same issue. Apparently when you first create a bucket, it won't show up in your list of buckets if you run Service.buckets
right away. However, you can immediately use the bucket to upload and download items.
It's a bit odd, since right at this moment, the Service.buckets
test returns an empty list for me, but I can use the bucket I just created without trouble. (Of course, this requires that I know the exact name of the bucket I want to work with myself.)
In any case, as your comment says, I'm assuming this is a timing issue on Amazon's side (rather than a problem with the gem). Follow-up: an hour later and the bucket shows up for Service.buckets
. So, to summarize: you can create a bucket and work on it right away (i.e. add items, download items), but the example code on the gem's homepage is a bit misleading. Immediate attempts to look up new buckets by name don't seem to work.
try this AWS::S3::Bucket.find('some-name')
精彩评论