I just started playing around with Amazon S3 and CloudFront and have managed to create a S3 Bucket and a Distribution on CloudFront.
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.
I uploaded some images in the S3 bucket and when I tried accessing the same for testing purpose with http://xxx.cloudfront.net/image.jpg I get the following error:
<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>ABCD1234</RequestId>
<HostId>
xxxxx
</HostId>
</Error>
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.
Has anyone here set this up before? How did you go about it?
My website is written with PHP.
Any help will be much appreciated.
Thanks,
m^e
UPDATE
The section on Basic Links in this AWS Doc page says that I can access my uploaded resource in the http://xxx.cloudfront.net/image.jpg format.
However, when I do that I get that Access Denied XML dump.
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:
http://xxx.cloudfront.net/1st-open-house-jan-2011.jpg?AWSAccessKeyId=yyy
Whenever I try polling my images in this format (including the AccessKey) it seems to work. Without AccessKey in the URL, nada.
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?