AWS Hosting (EC2, EBS, S3) for Dummies

    Notes on AWS (Amazon Web-Services) have periodically skipped on the hub - 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 - however, I did not know any details. I’ll try to tell in more detail on the basis of the experience I have just gained, as well as outline the main steps for organizing server hosting on AWS and its advantages. As well as a few links that may be useful.
    image

    Immediately I want to say thank you very much to the haberman Gomer who shared some basic information and links. In this matter, it turned out to be important to understand exactly which direction to dig from - so to speak, to get the first kick.

    So, the time has come to repair the apartment, and hosting my EmForgeon the home server (by the way, based on the Atom processor - but that's another story) - it became impossible. I went to this for a long time (keeping the server at home was not a good idea). Where to go? Dedicated server - expensive, VPS - considering that my J2EE server required memory - it turned out not cheap either (at least 512 Mb needed) - plus a number of other problems. And so I decided (long time ago) that it was time for AWS. A
    first look at the website made it clear what I already heard. Yes, a set of web services, yes, it allows you to run image 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 also, the organization of server hosting using AWS can be compared to assembling a computer (compared to buying a ready-made one - ordering a hosting from a provider):
    • EC2 is the motherboard and memory. This service allows you to run image of the operating system (the launched image is called instance). But - it does not provide storage of any data - while instance is working - well - but if you stopped it - that's all. the next time you start, you will return to the original image
    • EBS is a screw. You can say - make me a 25 gig vinc (it’s possible from 1 Gb to 1Tb) and connect it to such an instance (the created vinc will be called volume). As a result, a new device appears in your system, then you mount it, format it, and work with it. Everything that was written to it is stored regardless of the life of the instance. You can also easily make snapshots (for example, to organize backups)
    • S3 is a tape. 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 other - I just had to host my server - ubuntu, tomcat, postgresql + my application itself. 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):
    1. register on AWS, get keys, install EC2-Tools. Under ubuntu there is a good starters guide . This will allow you to work with Amazon services.
    2. Choose the most suitable image (in aws they are called AMI) with which you will start building your system. The list of available AMIs can be found here in the console (a very useful tool). For ubuntu there are both official AMIs (listed on the same starter guide) and “advanced” ones (by the way, Eric is the author of these AMIs, ships around are very advanced people - very I recommend reading his blog - you can find answers to many questions). In my case, I chose the "advanced" 9.04
    3. 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)
    4. by default, all ports on the machine will be closed - you need to open 22 (for ssh) using ec2-authorize default -p 22 well, and in the future do not forget to open other necessary ports (for example 80)
    5. go to the running system via ssh, install and configure the necessary software (later we will do our AMI with everything we need)
    6. most likely, you will have a database and some other data that needs to be stored on the “hard drive” - 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
    7. 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, so that the data lies on the EBS Volume - and not inside the instance - remember - instance can die - and with it and the data will die - and EBS will remain
    8. in principe we got the system as we need it - now we need to “fix” this state (so as not to repeat installing and configuring the software each time a new instance is started). the same article describes how to make image for a running instance, put it on S3 and register your AMI
    9. Ok, you have your own AMI - now, if that - you can quickly raise the server with all the necessary software
    10. there’s a little thing left - take Elastic IP (fixed IP), change DNS to use the new IP, migrate data to the database. Server is ready!


    Minuses


    • AWS is complicated - well, at least compared to a simple hosting purchase. Although, hopefully, my article will help make it not so complicated.
    • AWS paid. Forget about the free limits for Google App Engine - you'll have to pay for everything - for every hour of instance, for traffic, for EBS, for accessing EBS and so on and so forth. To have an idea of ​​what and how much you have to pay, you can look at AWS Activityimage


    pros


    • Yes, paid, but not so expensive. When hosting, you will most likely not be interested in paying for instance by the hour - you can pay for the year. The minimum instance will cost you $ 325 a year - or less than $ 30 a month. Plus traffic, EBS, S3 - the total should not get more than 40. For this you get a machine with 1.7 Gb of memory and a percent equivalent to 1.0-1.2 GHz Opteron . VPS for the same money will be something at the level of 800 Mb of memory - that is, half as much
    • Yes, AWS is more difficult than just going and ordering a hosting - but it took me about 8 hours to do everything. Quite a reasonable time, I think
    • We expand AWS - you can run instance on the simplest machine - and then migrate to a machine with 15 gigabytes of memory (you only need to switch to a 64-bit system)
    • as mentioned above - AWS - constructor - organizing the server host - this is the simplest task that can be solved - as I understand it - AWS was originally intended for a little different (organization of clusters, etc.)


    I hope this information allows you to make the right choice and, if that, save time and money.

    UPD I just finished the post - as the Habr suggested a similar one - as I had not noticed before - maybe the "rice" confused?

    UPD2 transferred to hosting

    Also popular now: