Note that there are some explanatory texts on larger screens.

plurals
  1. POSimple image delivery with AWS CloudFront and PHP?
    text
    copied!<p>I just started playing around with Amazon S3 and CloudFront and have managed to create a S3 Bucket and a Distribution on CloudFront.</p> <p>My purpose is to use CloudFront for simple image / css delivery from edge locations - so I'm looking at the most basic of AWS functions.</p> <p>I uploaded some images in the S3 bucket and when I tried accessing the same for testing purpose with <a href="http://xxx.cloudfront.net/image.jpg" rel="nofollow">http://xxx.cloudfront.net/image.jpg</a> I get the following error:</p> <pre><code>&lt;Error&gt; &lt;Code&gt;AccessDenied&lt;/Code&gt; &lt;Message&gt;Access Denied&lt;/Message&gt; &lt;RequestId&gt;ABCD1234&lt;/RequestId&gt; &lt;HostId&gt; xxxxx &lt;/HostId&gt; &lt;/Error&gt; </code></pre> <p>I'm guessing I need to verify myself before I start delivering the content? I've grabbed the AWS-PHP SDK but then am at a loss as to what to do. All examples provided on the AWS Docs are for more complex functionality... there doesn't seem to be a straight-cut code sample for simple image delivery.</p> <p>Has anyone here set this up before? How did you go about it?</p> <p>My website is written with PHP. </p> <p>Any help will be much appreciated.</p> <p>Thanks,<br> m^e</p> <h2>UPDATE</h2> <p>The section on <strong>Basic Links</strong> in this <strong><a href="http://docs.amazonwebservices.com/AmazonCloudFront/latest/DeveloperGuide/" rel="nofollow">AWS Doc page</a></strong> says that I can access my uploaded resource in the <a href="http://xxx.cloudfront.net/image.jpg" rel="nofollow">http://xxx.cloudfront.net/image.jpg</a> format.</p> <p>However, when I do that I get that Access Denied XML dump.</p> <p>So I went back to the S3 bucket, right-clicked on the image and clicked Open. It opened up the image in a popup with the following link format:<br> <a href="http://xxx.cloudfront.net/1st-open-house-jan-2011.jpg?AWSAccessKeyId=yyy" rel="nofollow">http://xxx.cloudfront.net/1st-open-house-jan-2011.jpg?AWSAccessKeyId=yyy</a></p> <p>Whenever I try polling my images in this format (including the AccessKey) it seems to work. Without AccessKey in the URL, nada. </p> <p>Does that mean, I've to include that access key in every single image request throughout my website? Or is there any other means of pre-verifying a request at a single point and then on keep loading images normally, minus the access key in the url?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload