AWS News Blog
Using S3 to Store Media Files
|
Update November 9, 2021 – This post has been updated to remove broken links.
Adrian Holovaty is now using Amazon’s S3 to store files for his Chicago Crime site. In his recent blog post, “How I’m using Amazon’s S3 to store media files“, he describes the entire process of moving his files over. Adrian notes that it took him less than one hour to move his files over and to modify his code.
One of the commenters to the blog was surprised to find out that the objects in S3 are URL-addressible. This is absolutely the case, and is one of the very cool aspects of S3.
In fact, the image at right is stored within S3; I put it there using the S3 Perl / Curl sample.
You can verify this by right-clicking on the image and inspecting its properties. The image’s URL is “http://s3.amazonaws.com/aws_blog/images/chicago_crime.png” . In this case, aws_blog identifies the S3 bucket, and images/chicago_crime.png identifies the object (the image) within the bucket.
When I stored the image into S3 I set the content-type to “image/png” so that the browser would know that it was in fact an image. When S3 processes the HTTP GET from the browser, it returns the content type (along with any other S3 metadata attached to the object) using HTTP headers. Here’s what it returned for the image:
HTTP/1.1 200 OK x-amz-id-2: 0K7SmOorLULRBZUjPRDyQruOsnGkOYwcwIMz5nezKFjMVWsDgi099lZvY4qUCOsG x-amz-request-id: 52F4A02FC0C51299 Date: Fri, 07 Apr 2006 18:12:23 GMT Last-Modified: Fri, 07 Apr 2006 18:05:29 GMT ETag: "4f81c616c6e0e65dc6c957681941a3f4" Content-Type: image/png Content-Length: 75860 Connection: keep-alive Server: AmazonS3
As you can see, it would be easy to use S3’s metadata facility to store exta information about each object. Once information is stored in S3, you can get it back without retrieving the entire object using a simple and efficient HTTP HEAD request.
— Jeff;