title: Get non-expiring permanent amazon s3 object url
body: <p>My code looks like this:</p>
  
  <pre><code>module Operations
    class UploadFileToS3 &lt; MethodStruct.new(:params)
      def call
        s3 = Aws::S3::Resource.new(region: ENV['S3_REGION'])
        obj = s3.bucket(ENV['S3_BUCKET_NAME']).object(object_name)
        obj.upload_file(params[:tempfile_path],
                        content_type: params[:content_type],
                        acl: 'public-read')
        {
          url: obj.presigned_url(:get),
          # url: obj.public_url,
          filename: object_name
        }
      end
  
      private
  
      def object_name
        "#{params[:timestamp]}-#{params[:uuid]}#{params[:thumbname_suffix]}"
      end
    end
  end
  </code></pre>
  
  <p>For all uploaded files, the following properties are set automatically: </p>
  
  <pre><code>Expiry Date: None
  Expiration Rule: N/A
  </code></pre>
  
  <p>Uploaded objects's <code>Permissions</code> include:</p>
  
  <pre><code>Everyone: Open/Download
  </code></pre>
  
  <p>Bucket's <code>Permissions</code> include:</p>
  
  <pre><code>Everyone: View Permissions
  </code></pre>
  
  <p>Bucket policy looks like this:</p>
  
  <pre><code>{
      "Version": "2012-10-17",
      "Statement": [
          {
              "Sid": "AddPerm",
              "Effect": "Allow",
              "Principal": "*",
              "Action": "s3:GetObject",
              "Resource": "arn:aws:s3:::&lt;BUCKETNAME&gt;/*"
          }
      ]
  }    
  </code></pre>
  
  <p>Commented out <code>obj.public_url</code> returns bare link to object (no query string attached), which expires as well and then renders xml file. Bare link taken straight from the object props expires too, even if I manually add to the object's <code>Permissions</code>:</p>
  
  <pre><code>Everyone: View Permissions
  </code></pre>
  
  <p>Even if I make an object public via AWS console, the link it gives me includes header <code>X-Amz-Expires=300</code>. </p>
  
  <p>Trying to use <code>obj.presigned_url(:get, acl: 'public-read')</code> throws <code>ArgumentError - unexpected value at params[:acl]</code>.</p>
  
  <p>I would like to use this bucket as storage for avatars so everyone should be able to see the linked picture at all times. Any ideas how to get the really permanent url that will not expire nor today neither in one year?</p>