When you work with a team, and on some reason do not want to have own server, you can use EC2 from Amazon. Clouds become more and more popular and, of course, cheaper. At this moment, Amazon allows you to use EC2 micro instance about 1year for free. If you will not try to load it heavy. To check restrictions and get more info about it, visit aws.amazon.com
Recently, I decide to create own development instance. So, I decided to make quick installation quide how to create development server quickly. I suppose that you already have account on Amazon AWS. If not, you can register here.
I had a choose from Google VPS and Amason EC2, but decided to use Amazon, because its
- first year is free
- if project is not heavy loaded, its cheaper than Google VPS.
In order to make installation faster, I decided to use Ubuntu Server 14.04 LTS (HVM):
Amazon have nice and user-friendly user interface, so you won’t be confused.
Next step, lets select instance type. Micro instance is for free, so lets select this one:
Then we can select disk space and type. You can select up to 30GB for free.
After selection disk space and type, we can make basic settings for SecurityGroup:
When you choose Source «MyIP», you should understand: if your IP is not static, you will have to update it every time if changes.
And on last step you can select/generate keys for connection to server. DO NOT forget to download this key. Otherwise you will not be able to connect to your instance.
So, we made basic operations and successfully created our Amazon EC2 Instance and you have your private key, nice, lets continue.
- put your key to ~/.ssh/ folder and execute command:
- find IP of your instance, you will need it for connection
Your IP you can find here:
Btw, if you press button «Connect», you will get help, how to connect to instance.
Then lets create ssh alias for quick connection to Amazon. As you see, I have IP 220.127.116.11, so I’ll use this one in example, and you will use our own:
And create alias:
- Host amazon
- Hostname 18.104.22.168
- IdentityFile /path/to/your/private/key.pem
- Compression yes
- ForwardAgent yes
- User ubuntu
Host amazon Hostname 22.214.171.124 IdentityFile /path/to/your/private/key.pem Compression yes ForwardAgent yes User ubuntu
Nice, lets connect to our new server:
If you cant connect, try this:
- check IP address
- check permission of private key file.
- check SecirityGroups in Amazon EC2 Management Console: SecurityGroups->Select Your Group->Inboud tab->Check if you have SSH in your settings:
If you want to use web server , you must allow port 80 in SecurityGroups:
Additionally we should add swap file. Micro instance has 1GB of memory, so I’m sure I may have «out of memory» errors. Lets add +1GB(1024MB) swap:
- sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
- sudo /sbin/mkswap /var/swap.1
- sudo /sbin/swapon /var/swap.1
sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024 sudo /sbin/mkswap /var/swap.1 sudo /sbin/swapon /var/swap.1
Btw, you can set another swap size, but I do not see any sense to make it bigger.
If you want to enable it by default after reboot, add this line to
Instance is created and launched, ports are open, we can connect to it using SSH, so first step is completed.
Next steps are: