A simple gem will help you create two values: Signature and Policy - https://github.com/vinhnglx/s3-authorize
This gem is very useful when working with AngularJS file upload
I've been using this gist (https://gist.github.com/stefanneculai/deed108fad534d0db3ff) for my prototypes, but a require is way more productive.