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 am new to Amazon AWS and fairly new to Web hosting in general. I previously used Bluehost for web hosting, but my company is switching to AWS. I'm wondering what the best practices are for uploading php, html, and css files. We are constantly adding and tweaking the pages on our site and I need to know how to fit this into the AWS way of doing things.

Previously we simply used an FTP client to change the files on our server. Now I used Elastic Beanstalk to set up our stack, and have figured out how to use the FTP program to upload files to an EC2 volume using SFTP. However, when a new Instance gets launched, it does not contain the most recent changes.

I know that with Elastic Beanstalk I could upload a new version, but I don't really want to have to zip-up, upload, and deploy a new version of all my files, even if I've made just one small change.

We are not hosting a static website. We make pretty heavy use of a MySQL database to generate and change pages.

Are there better options out there? Ideally, I would have one place to keep my php etc files and any running instances would get the files from there.

Any help, direction, tutorials are much appreciated. Thanks

share|improve this question
    
That's how Elastic Beanstalk works. You can always run bare EC2 server instances on AWS and manage this sort of stuff yourself. It's a tradeoff. –  ceejayoz Jan 7 '13 at 17:39

2 Answers 2

up vote 3 down vote accepted

You can do couple of different things here.

  1. First is, using a different storage instead, like using S3, where you store all your files and upload the latest files over there.

    S3 is more like a network storage. You can upload your files there and then access them from different instances.

  2. Second option is that you use the EC2 command line tools, create a new AMI whenever you change the files, and use the new AMI to launch new instances. By this case you will always have the latest data.

    So, when a new Instance in launched in ElasticBeanStalk, it uses a default AMI, but you can create new AMI and configure to use the new AMI. So, you can make scripts which will create a new AMI as soon as you are done with changes and delete the old one and use this AMI to launch a new instance.

  3. Third options is, as told by ceejayoz, you can use EC2 instances instead of ElasticBeanStalk and customize it according to your needs.

I usually prefer the third option, as I want to customize things on my own, and want the control of the whole system, software etc. But that's just me. You can go for any of the above options.

share|improve this answer

It's normally best practice to use executable files such as PHP within an instance - Statics files are best served on a Content Delivery Network for Maximum speed and global mirror benefits in this case for Amazon its Amazon Simple Storage Service (Amazon S3).

On Amazons CDN network you can set TTL within each container you make. TTL is basiclly a fancy cache that caches content globally for X mintues before checking if the file has been renewed or not.

For images it's not regular you need this to have a low expire time so you could set the TTL to 2 weeks. While your site my make active changes daily to the CSS file so you could set the TTL to 5mins on the CSS container.

CDN's are ideal for all files that don't need server side exercuting - its great for serving content faster and actually frees up resources on the main server by limiting the requests.

Since you are familiar with FTP I strongly advise you take a look at:

Cyberduck http://cyberduck.ch

Cyberduck is absolutely amazing at administrating your Files on the Cloud on various networks such as Amazon, Rackspace, Limelight etc etc.

Furthermore, if you need regular updates to your server to the PHP files then you should take a look at EC2 suggested by GeekRide. But don't overlook using the S3 as the its better to use it than not use it.

share|improve this answer

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.