title: AWS CloudFront pre-signed URL for S3 Bucket without OAI not working
body: <p>I tried to create CloudFront pre-signed URL (without OAI) manually for my S3 Bucket with HelloWorld.html as per</p>
  <p><a href="https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/PrivateContent.html</a> .</p>
  <p>That's not working. Below are the manual step I performed:</p>
  <ol>
  <li>Logged on to root, and setup CloudFront Key pair.  Downloaded Both Public and Private Keys</li>
  <li>I then set up CloudFront to point to my S3 Bucket with option of pre-signed URL but without OAI. Used aws cloudfront get-distribution to check if it shows correct Key Pair ID that I setup on step 1</li>
  <li>I wrote and tried with 3 bucket polices  : i) using entire CloudFront base URL + Object ii)  using just s3 object name ,  iii)  a policy using entire S3 URL for the above object  (unfortunately, stackoverflow is not allowing to add the bucket polices saying &quot;not properly formatted as code&quot;.  The polices I wrote was as recommended in user guide with no spaces, enters and tabs)</li>
  <li>I then command &quot;openssl req -x509 -new -days 100000 -key -out&quot; to convert downloaded private PEM file to a Cert file</li>
  <li>I then used &quot;openssl smime -encrypt -aes-256-cbc&quot; command to encrypt (or to create signature) for the   Step 3 policy using Step 5 cert file</li>
  <li>Then I edited the signature from Step 5 to replace &quot;/&quot; with &quot;_&quot;, &quot;+&quot; with &quot;-&quot; and &quot;=&quot; with &quot;~&quot; as AWS need for signed URL</li>
  <li>Then I created following &quot;signed &quot; URL manually with above edited Signature: <a href="https://xxx.cloudfront.net/HelloWorld.html?Key-Pair-Id=" rel="nofollow noreferrer">https://xxx.cloudfront.net/HelloWorld.html?Key-Pair-Id=</a>&lt;Key-Pair-Id from step 1&gt;&amp;Expires=3600&amp;Signature=&lt;Edited Signature from Step 6&gt;</li>
  </ol>
  <p>I consistently get &quot;AccessDenied&quot; error.</p>
  <p>What is wrong or missing in above steps?</p>
  <p>I suspect missing IAM policy on S3 for CloudFront.  I tried Full Public Access for S3, but still getting AccessDenied error.  AWS user guide explains how to write S3 IAM policy for CLoudFront using OAI, but does not explain writing S3 IAM policy for CloudFront pre-signed URL without OAI.</p>