title: How to Generate a Secure URL to Download File from s3 Using Ruby aws/s3 Gem
body: <p>I am writing a small script to locate a specific file in a bucket on aws and create a temporarily authenticated url to send to colleagues. (Ideally, this would create a result similar to right-clicking a file in a bucket on the console and copying the link address). </p>
  
  <p>I have looked into paperclip, which doesn't appear to meet this criteria, however I could just not be aware of its full capabilities.</p>
  
  <p>I tried the following:</p>
  
  <blockquote>
  <pre><code>def authenticated_url(file_name, bucket)
    AWS::S3::S3Object.url_for(file_name, bucket, :secure =&gt; true, :expires =&gt; 20*60)
  end
  </code></pre>
  </blockquote>
  
  <p>Which produced this type of result:</p>
  
  <blockquote>
    <p>...-1.amazonaws.com/file_path/file.zip.AWSAccessKeyId={key}Expires=1200&amp;Signature={...}</p>
  </blockquote>
  
  <p>Is there a way to create a secure url more similar to the scenario described above that could simply be sent as a link? If not, any secure alternatives would be welcomed. </p>