Amazon.Development server installation on EC2 (quick quide)

by alex, 2014-10-28

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

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:
    1. $chmod 400/path/to/your/private/key.pem
    $chmod 400/path/to/your/private/key.pem
  • 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, so I’ll use this one in example, and you will use our own:

  1. $sudo vim ~/.ssh/configs
$sudo vim ~/.ssh/configs

And create alias:

  1. Host amazon
  2.  Hostname
  3.  IdentityFile /path/to/your/private/key.pem
  4.  Compression yes
  5.  ForwardAgent yes
  6.  User ubuntu
Host amazon
 IdentityFile /path/to/your/private/key.pem
 Compression yes
 ForwardAgent yes
 User ubuntu

Nice, lets connect to our new server:

  1. $sudo ssh amazon
$sudo ssh amazon

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:

  1. sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024
  2. sudo /sbin/mkswap /var/swap.1
  3. 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

  1. /etc/fstab

  1. /var/swap.1 swap swap defaults 0 0
/var/swap.1 swap swap defaults 0 0

Instance is created and launched, ports are open, we can connect to it using SSH, so first step is completed.

Next steps are:


It's only fair to share...Share on FacebookShare on Google+Tweet about this on TwitterEmail this to someoneShare on LinkedIn

No Comments

Leave a Reply

Your email address will not be published Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code lang=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre lang="" extra="">


5 × 1 =