Do I need Amazon's EC2, Cloudfront, RDS?

atp picture atp · Mar 20, 2010 · Viewed 7k times · Source

I want to publish a web site on Amazon's servers, that:

  1. Runs CakePHP
  2. Uses MySQL to store data
  3. Lets users upload audio through flash (currently using a hosted Flash Media Server), and listen to the files later

Do I need Amazon's EC2 for the website, RDS for the MySQL database, and CloudFront for the FMS? I'd really like a walkthrough of which services I should use.

Thanks.

Answer

kgiannakakis picture kgiannakakis · Apr 14, 2010

First of all you need EC2 service in order to have a virtual machine, where you can install Apache, PHP and your Web Application.

Then you also need a database server and data repository for the media files. The recommended way is exactly what you suggest: RDS for MySQL and CloudFront as the file repository.

Initially none of the above services (RDS, CloudFront and even EBS) were available. Developers have no way to use a MySQL database, because even if it was installed in an EC2 instance, the instance isn't guaranteed to stay up and running and if the instance is lost, the data is also lost. For this reason EBS was introduced. It created a mounted storage with guaranteed persistence that you could access from the EC2 instance. Theoretically you could install MySQL there and use it to store the flash files. If you only want to serve files through the HTTP protocol, there is no problem using EBS.

CloudFront however has some advantages:

  • Users are automatically routed to the nearest edge location for high performance delivery of your content.
  • You can also use it to stream content through the the RTMP protocol.
  • You don't have to worry about the size of the storage. With EBS you create a storage with a specific size. This could be a problem if you later find out that you need more storage. With CloudFront the files are installed in S3 and you do not need to worry about their size.
  • You do not waste web server capacity. If you use EBS, the files will be served by the server in EC2.

You could also use S3, but you wouldn't able to use the RTMP protocol and you would need to manually create links to your files. Also, it wouldn't be possible to use your domain name for the files.

RDS also has some advantages over installing MySQL in EC2, EBS:

  • automated database backups
  • You can monitor your database with Amazon CloudWatch (free service)