A badly-copied and extended version of http://wordpress.org/plugins/amazon-s3-and-cloudfront/