Recently I have created a web application. The application has some static parts (libraries, classes etc) and dynamic parts (images, cache, log etc) as well. However, some static parts of the app would need rare changes. Let's call them partially static. As a whole there are static, partially static and dynamic parts.

So I am trying to adapt my app to Amazon AWS (EC2 and S3). I don't think it is a good idea to put all the application files to an EC2 instance. I am thinking to put static and partially static parts to EC2 and dynamic parts to S3.

  • As soon as I get the application stabilized on EC2, I will create an AMI and copy it to new instances.
  • Whenever I need change in partially static parts, then I would terminate all EC2 instances except one, and make changes. After changes, I would create new instances.
  • Dynamic parts like uploaded files, images etc. will be shared by all instances and not cause any synchronization problems.

Is this an appropriate way to use EC2 and S3?


I am thinking to put static and partially static parts to EC2 and dynamic parts to S3.

I think you're using the terms static and dynamic differently than most of us here would understand it. Static data would be images uploaded by users. Dynamic data would be things that generated by code. I think what you're focusing on is the frequency in which that data might change. Perhaps you mean that user images are static in the sense that once they're uploaded they'll never change as opposed to a static HTML file that you might update once in a while. Moving forward, I'm going to refer to static and dynamic on my own terms respectively: files that are served as-is and files that are code which generate data.

Files that are static should be hosted on S3. Even if you might eventually alter them or stop referencing them. It may be best to simply make each version of a file have a unique name.

Dynamic data should be hosted on your EC2 instances. Ideally, you'll have a method of updating that data without terminate instances, possibly be means of a shared filesystem that would allow you to keep all nodes synchronous about what they're serving. Alternately, if small gaps in time where nodes are serving from different code could possibly be acceptable, you could also also use scripts to push files out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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