On Habré already periodically skipped notes on AWS (Amazon Web-Services) - so the topic is not new. However, if for me personally (and for many of my friends, as it turned out) - this term was familiar - but I did not know any details. I will try to tell you a little more on the basis of the experience I have just gained, and also outline the main steps for hosting a server on AWS and its advantages. Like a few links that may be helpful.

Immediately I want to say a huge thank you to haber man
Gomer who shared some basic information and links. In this case, it turned out to be important to understand precisely - from which side to dig - to get the first kick, so to speak.
So, the moment of repair in the apartment has come, and hosting my
EmForge on a home server (by the way, based on the Atom processor - but this is a separate story) - became impossible. I went to this for a long time (keeping the server at home was not the best idea). Where to go? Dedicated server is expensive, VPS - given that my server on J2EE required memory - it also turned out not cheap (at least it was necessary to 512 Mb) - plus a number of other problems. And so I decided (I was going for a long time) that it was
AWS time
The first look at the website made it clear what I already heard. Yes, a set of web services, yes, it allows you to run an image of operating systems, yes, you can store data. But how? So, in order.
In principle, if we talk about AWS, then this is a constructor. With which you can do a lot of things - the main thing is to be able to do. And yet, hosting a server using AWS can be compared to building a computer (compared to buying a ready one, ordering hosting from a provider):
- EC2 is motherboard and memory. This service allows you to run the image of the operating system (the running image is called instance). But - it does not provide storage of any data - while the instance is working - well - but if you stopped it - that's all. next time you start you will return to the original image
- EBS is Vinci. You can say - make me a Vinci with a size of 25 gigs (you can from 1 Gb to 1Tb) and connect it to such an instance (the created Vinci will be called volume). As a result, a new device appears in your system, then you mount it, format it and work with it. All that was recorded on it - is saved regardless of the life of the instance. You can also easily make snapshot s (for example, for organizing backups)
- S3 is a ribbon. There you can save large files and store them there forever.
')
I will not consider here the organization of cluster systems, High Aviability systems and so on - I just had to pick up my server - ubuntu, tomcat, postgresql + actually my application. What had to be done (if this is not very interesting - you can immediately go to the end - where the pros and cons are described):
- Sign up for AWS, get the keys, put EC2-Tools. Under ubuntu there is a good starters guide . This will allow you to work with Amazon services.
- Select the most appropriate image (in aws they are called AMI) from which you will start building your system. The list of available AMIs can be viewed here , in the console (a very useful tool). For ubuntu there are both official AMIs (listed on the same starter guide) and “advanced” (by the way - Eric is the author of these AMIs - ships for all advanced people - very I recommend reading his blog - you can find answers to many questions). In my case, I chose “advanced” 9.04
- run the selected AMI (see ec2-run-instances) - at startup, you can specify which motherboard to run (how much memory, percent) and where to run (states, europe)
- By default, all ports on the machine will be closed - you need to open 22 (for ssh) with ec2-authorize default -p 22 and in the future do not forget to open other necessary ports (for example, 80)
- log in to the running system via ssh, install and configure the necessary software (later we will make our AMI with everything we need)
- Most likely, you will have a base and some other data that you need to store on “Vinca” - therefore, you need to make an EBS volume and connect it to your instance machine. A good description of how to do this (well, in principle, an article that turned out to be the most useful for me) is here - just pay attention to the comments about the use of Ext3 & XFS file systems from the same Eric
- after you connect volume to your system - you need to change the settings of the database and other services so that the necessary data is stored on it - that is, the data lay on the EBS Volume - and not inside the instance - remember - an instance can die - and with it and the data will die - and EBS will remain
- in the script we got the system we need it - now we need to “fix” this state (so as not to repeat the installation and configuration of the software every time a new instance is started). the same article describes how to make an image for a running instance, put it on S3 and register your AMI
- Ok, you have your own AMI - now, if that - you can quickly raise the server with all the necessary software
- there was a trifle - to take Elastic IP (fixed IP), change the DNS to use the new IP, migrate the data to the database. The server is ready!
Minuses
- AWS is complicated - well, at least compared to just buying hosting. Although, I hope my article will help make it not so difficult
- AWS paid. Forget about free limits ala Google App Engine - you will have to pay for everything - for each hour of work of the instance, for traffic, for EBS, for contacting EBS and so on and so forth. To have an idea of what and how much to pay - you can look at AWS Activity

pros
- Yes, paid, but not so expensive. When organizing hosting, you probably will not be interested in paying for the instance by the hour - you can pay a year. The minimum instance will cost you $ 325 a year - or less than 30 bucks a month. Plus traffic, EBS, S3 - in the amount should not get more than 40. For this you get a car with 1.7 Gb of memory and a percentage equivalent to 1.0-1.2 GHz Opteron . VPS for tezhe money will be something at the level of 800 Mb of memory - that is, two times less
- Yes, AWS is more complicated than just going and ordering hosting - but it took me about 8 hours to do everything. It is a reasonable time I think
- AWS is expandable - you can run the instance on the simplest machine - and then migrate to a machine with 15 gigabytes of memory (you just need to switch to a 64-bit system)
- as mentioned above - AWS - constructor - organization of the host of the server - this is the simplest task that can be solved - as I understood it - initially AWS was intended for a slightly different (cluster organization, etc.)
I hope this information will allow you to make the right choice and, if anything, save time and money
UPD Just finished the post - as Habr suggested a
similar one - as I hadn’t noticed it before - maybe “rice” confused?
UPD2 moved to hosting