Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm new to the Amazon EC2/EBS system. I'm trying to figure out the "best practice" for hosting a web application (php, ASP.NET, etc.). The way I see it, I have 2 options:

  1. Have the instance hold my web files - Don't need to worry about attaching volume's etc.?
  2. Have EBS volume hold my web files - Easily update with new code without needing to recreate the AMI for new updates?

How do others handle this?

share|improve this question
    
Are you talking about one instance or a collection of them? –  Jeff Ferland Sep 18 '12 at 19:44
1  
Just 1 instance... I'm just trying to understand if there's any benefit to updating the EBS files as opposed to updating them on the EC2 instance. –  MattB Sep 18 '12 at 19:54
    
Just use an EBS-backed instance instead of an ephemeral instance, then. –  Jeff Ferland Sep 18 '12 at 19:59

1 Answer 1

up vote 4 down vote accepted

If your instance is "EBS-backed", then your root volume will be EBS. From your operating system's point of view, it will just look like an ordinary volume, but the data will be persisted to the EBS storage. You don't need to do anything special. If you desire, you can attach a second EBS volume to store your data on. Once it's attached, then it will just look like any other volume.

If your instance is "instance-store", then you don't have the option of stopping and restarting your instance. You can only terminate it, and if you do (whether intentionally or not), any updates to your root volume will be lost and you will need to re-install and re-upload your data.

Even if you use an EBS-backed EC2 instance, I recommend creating an AMI image in case you need to create a new instance (if your original instance goes down or is otherwise inaccessible).

I recommend following a gold-ami-instance pattern:

  1. Create a "gold" EC2 instance which is considered your "master copy". All updates are done to this instance, but this instance is never accessed by your visitors, only you via RDP, SSH, etc. Turn this instance off except when updating.
  2. Create an AMI of your gold instance.
  3. Create as many instances from your AMI image as needed. Point your Elastic IP or ELB to these instances (not your gold instance). These instance should have RDP, SSH access blocked using security groups. Only let http/https through.
  4. When you need to update your website, start your gold instance, update the site on that instance, create a new AMI, then launch new instances from the new AMI and terminate the old instances.
share|improve this answer
    
+1 and wholeheartedly recommend setting up EBS snapshots periodically, especially if you're just going with one instance. –  gravyface Sep 18 '12 at 20:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.