Jul 19

Amazon offers a great service that allows you to host your files on their servers for a small charge called Simple Storage Service or S3 for short. The fee schedule is as follows:

  • Storage
  • $0.15 per GB-Month of storage used
  • Data Transfer
    • $0.10 per GB - all data transfer in
    • $0.18 per GB - first 10 TB / month data transfer out
    • $0.16 per GB - next 40 TB / month data transfer out
    • $0.13 per GB - data transfer out / month over 50 TB
  • Requests
    • $0.01 per 1,000 PUT or LIST requests
    • $0.01 per 10,000 GET and all other requests*

    If you are strapped for bandwidth, want to speed up your site or want to handle the digg effect like a champ then S3 is for you. It is extremely affordable and their is no minimum fee so you can easily try it out for a period of time and you bill could be as low as a few cents.The problem is that if you want to use the S3 service for hosting files to be served on your website, they give you a hideous URL. This tutorial will show you how to use a sub domain from your own domain to point to your S3 bucket. In short this tutorial takes this

    https://s3.amazonaws.com/5tags/conf_room.jpg?AWSAccessKeyId=1MAQQAHYZFCDAD01MG02&Expires=1184870730&
    Signature=CZnuUaqrqHzvAS9sgDFAEFdse1zw%3D        

    to this

    http://assets.5tags.com/file.jpg        

    What You Need

    Where to Begin

    s3fox.png 

    You will first have to go to S3browse.com to create a new bucket. You can either do a temporary sign in or register at the site. S3Browse is a web based front end that makes uploading and bucket management significantly easier. To sign in you must have your access key id and your secret access key which can be found at Amazon’s Web Services section, under AWS Access Identifiers.Once signed into S3Browse you will be presented with your list of buckets.

     

    acls.png

    What To Do

    • Create a new buckets with the exact same name as your subdomain. In my case “assets.5tags.com”
    • You should have the S3Fox plugin installed. Open S3Fox from the tools menu. Your bucket list should appear.
    • Click the bucket (folder) that you just created once.
    • Click the “pencil on paper” icon directly above to edit the permissions
    • Make sure that read is enabled for everybody. This makes the urls shorter and easier.
    • While in S3Fox, upload a test file into the bucket

    In short we just created a new bucket, and allowed anybody to access it via the web. S3 defaults so that URLS are generated on the fly that include expiry dates, and the unique id. This is so that the rightful owner of the file can generate URLs to give to colleagues that have expiry dates, and random people can’t browse their files.

    Setting Up the DNS

    This is where all of the fun begins if you don’t have a host that supports easy DNS modifications. If you have a host like Dreamhost or Media Temple then it is very simple. There are 1000s of hosts our there and the procedure is generally the exact same. For today I will show how to do it on Media Temple’s grid server as well as Dreamhost.In short you want to create a CNAME record that maps a nickname (your subdomain) to “s3.amazonaws.com.”.

    Media Temple - Grid Server

    mt.png 

    • Go to the domain where you want to create the sub domain in the Media Temple Account Center
    • Go to “Edit Zone” and click “+ Add a Record”
    • For “Name” type the full sub domain you want to use. In my case “assets.5tags.com”
    • Make the “Type” “CNAME”
    • Under “Data” type “s3.amazonaws.com.” make sure you include the trailing period.
    • Save the settings and YOU ARE DONE!
    Dreamhost

    dh.png

     

  • Go to the Dreamhost Panel and go to “Manage Domains”
  • Directly under the domain you want to create the sub domain for, click DNS
  • Under “Name” type the start of the sub domain. In my case “assets”
  • For “Type” select “CNAME”
  • For “Value” type “s3.amazonaws.com.” make sure you include the trailing period.
  • You can leave the comment blank, save your settings, YOU ARE DONE!
  • In The End

    By using Amazon’s S3 for you files on our website you can not only save expensive bandwidth from your web host but you can also make your website load a lot faster. The high majority of the load time of a web page is the images. By serving them from S3 you can count on fast, reliable, service. By having the images under you own sub domain you not only appear more professional but trick people into thinking the files are coming off your own server, which can have several benefits. If you are on a cheap web host and don’t want to take the risk of paying large bandwidth overage bills then S3 is great for you!

    Sep 3

    So you want to use “Shorty”, the short URL engine, but can’t seem to be able to install it on Media Temple’s servers. Here is how I got it to work.

    1. Download the latest Shorty. For this tutorial I used the first beta.
    2. Create a new database or find the database name of an existing one. I suggest that you use an existing one becuase (mt) have a limit.
    3. Upload the ’shorty’ directory to your web server. You can rename it to anything you wish now or after the installation. I named mine “go” so that my short URLs are “5tags.com/go/url”
    4. Download my edited _install.php file. I had to change a few things to make it work on Media Temple.
    5. Run the included installer http://yourdomain.com/shorty/_install.php
    6. If you get an error about a .htaccess file make sure that you uploaded that to the “shorty” directory with everything else.
    7. As directed, remove the _install.php file from the directory for security reasons.
    8. You are good to go.