I'm uploading a file to an S3 bucket for which I've created a Cloudfront distribution. I'm using the Aws\S3\S3Client
class.
After uploading with putObject
, the response object and the getObjectUrl
method both return the object's url as https://s3-eu-west-1.amazonaws.com/mybucket/path/myfile.jpg. I am trying to get the Cloudfront url which would be something like https://d111111111ck.cloudfront.net/path/myfile.jpg.
Is there any way to get this url directly, or do I have to build it from my distribution hostname and file path?