Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I use EBS or S3 to store my database on?

I want to host a website on an Amazon EC2 instance, but for reliability purposes, I want to have the underlying database on some more permanent storage medium. There won't be any file uploading or anything like that, but I want to make sure that the database queries and updates are going quickly. Should I use EBS or S3 for this?

And just comment if you want more info

like image 210
cfrederich Avatar asked Jun 09 '11 17:06

cfrederich


3 Answers

You can not store a database on S3. If you intend to store your database anywhere it will either be on EBS or on instance storage.

like image 181
Femi Avatar answered Sep 20 '22 14:09

Femi


Just to build on the other very nice answers, you can store your database as a .sql file on s3. But your website/application can't make queries to this file because s3 has no MySQL program (file!=database).

Amazon RDS stores backups of your database to s3 as .sql files (I assume) which they programmatically access and use to restore your RDS database instance in the event of its failure.

The advantages of EBS vs. RDS are stated in other answers but just to be clear, a key benefit of RDS is that Amazon takes care of restoring your failed instance by providing backups, etc.

I'm not sure about the DB replication part though as that appears to be a separate concept and I've read that this is NOT a feature of RDS. More experienced DBAs seem to point this out often as a reason NOT to use RDS. Might someone clarify this?

like image 2
tim peterson Avatar answered Sep 20 '22 14:09

tim peterson


Like, @Femi said, you can not use S3 for DB, but you can use one of these instance-store/EBS/RDS. More info below:

Instance store will disappear if your instance is crashed, + EBS volume got quite a good problem recently - though this is good over instance-store, I would suggest you to have a look at Amazon RDS, I had used it for one my project and it's super cool.

Amazon RDS has got quite a good advantages:

http://aws.amazon.com/rds/

Features:

  • Automated Backups
  • DB Snapshots
  • Automatic Host Replacement
  • Replication

When you compare EBS with RDS, both are charged where as little extra on RDS when compared to EBS, but its worth. Amazon takes care of everything and if your site is traffic-driven, it has got solution to replicate automatically.

like image 1
Rakesh Sankar Avatar answered Sep 24 '22 14:09

Rakesh Sankar