Funny you posted here today, I was JUST NOW messing around with this & CDN for Joomla. I haven't had time to "hack" the file yet, but I did manage to get it working with CDN for Joomla.
Site Root:
https://s3-sa-east-1.amazonaws.com/bucket-name
CDN Domain: blahblahblah1.cloudfront.net
The reason I couldn't get it working before is because apparently CloudFront does not like you adding S3 buckets as origins to an existing S3 distro. So I created a new one with my ES bucket as the origin and now it works.
Now, the problem with CDN for Joomla is it only has room for 5 CDNs, so anyone using https like me are restricted to two CDNs, because each one actually needs two slots: one slot for media.mydomain.com and one slot for the raw cloudfront.net domain over https (remember it costs hundreds of dollars to have a custom SSL cert on CloudFront).
So, non-urgent feature request: setting in admin to re-write s3 bucket URL replacing it with CDN url, one field for http and one field for https.