Search code examples
ruby-on-railsruby-on-rails-3amazon-s3paperclipamazon-cloudfront

how to define s3.yml bucket with a directory?


right now I have something like this for my s3.yml:

development:
    bucket: mydev
    access_key_id: xxxxxxxx
    secret_access_key: xxxx+qlSn+xxxxx

I want the bucket to be /mysite/dev

But that's not working with AWS::S3

So I could do:

development:
    bucket: mysite/dev
production:
    bucket: mysite/prod

The reason I want that is because then I can setup a CloudFront s3 bucket to mysite, which would then work across all the environments. Ideas?

Anyone know how I can make the bucket a directory tree?


Solution

  • Looking through the code it doesn't look like there is a concrete way to setup a bucket to act like this especially when you are reading and writing. You would need to set an option to prefix any path with the folder that you specify however this does not seem possible without modifying a large part of the code base and you would seem to lose the ability to run whole bucket operations.

    I would look into naming the buckets with development and production prefixes and just use two sets of cloudfront, It doesn't look like that should have additional fiscal costs because of the way the pricing is set up.