Search code examples
phpamazon-s3amazon-cloudfront

specifying a 30s ACL not working with Cloudfront?


Using the PHP Amazon SDK I am successfully able to set a 30 second access for a URL using the following functin: get_object_url($bucket, $filename, $preauth = 0, $opt = null)

$s3->get_object_url($results['s3.bucket.name'], $results['s3.file.name'], '30 seconds');

Now, the issue with this is that it returns a fantastic URL:

"s3.url": "http://THECOOLEST.BUCKET.INTHEWORLD.EVER.s3.amazonaws.com/2011/04/18/image/png/8ba2d302-a441-45d4-8354-08e2b7e1a325.png?AWSAccessKeyId=XXXXXXXXXXXXXXXXX&Expires=1303162244&Signature=AWdUnHSaIBDmRcbwo2RFSUQaqBM%3D",

When I change the URL to the CNAME we use for cloudfront, the ACL doesn't work. Anyone know how to get_object_url with the CNAME configured?


Solution

  • Cloudfront and S3 are two different things.

    You need to setup a CNAME for your S3 bucket. See the AWS docs for more info: http://docs.amazonwebservices.com/AmazonS3/latest/dev/index.html?VirtualHosting.html#VirtualHostingCustomURLs