How to Setup an Amazon EC2 Instance to Host Ghost for Free (Self-Install)

If you would rather use our pre-built AMI (Amazon Machine Image) that has Ghost already installed and ready to use, check out this article. If you would like to install Ghost manually, continue with this article!

A lot of people know Amazon's hosting as Amazon S3, but we are actually going to be using their EC2 section. Through Amazon EC2, you can host a website with a database backend for free (with limits). Amazon has a Free Tier that you can build a website on that as long as you don't get a ton of traffic or have a lot of server side data use, it will stay free. (you can setup alerts to let you know if its ever going to cost you money) Here is a step by step guide to setting it up:

  1. Head over to the Amazon Web Services site and sign up using your existing Amazon account or create one.
  2. Go ahead and enter in your payment information. The way the Amazon free tier works is that if you go over a certain threshold they will charge you, but what we are setting up will be free and remain that way unless you get a lot of hits or server side data use.
  3. Verify by phone and then on the next page, verify through your email once it arrives.
  4. Once you click the link in the email you got, go ahead and go to the AWS Management Console.
  5. Click on EC2 on the left side and wait for that email to come through (from previous setups I have had the email take anywhere from minutes to an hour to arrive).
  6. Once you get the email and your access to EC2 has been allowed, go ahead and click on the EC2 Link on the AWS Management Console page.
  7. Once on this page, click on "Launch Instance"
  8. That will bring up a little wizard that looks like this:
  9. Create New EC2 Instance
  10. Go ahead and hit continue with the Classic Wizard and it will take you to this page:
  11. Amazon EC2 Instances
  12. The very first option, `"Amazon Linux AMI"`. [32 or 64 bit, up to you] and then hit "Select"
  13. Keep everything the same on this page, you want the instance to be Micro so it will stay free. Hit Continue.
  14. Amazon EC2 Request Instance
  15. Keep everything as the default for the next two pages. Once you get to the "Key" page, enter in the name and value that you want as your key. Doesn't really matter what you put. Hit Continue.
  16. Amazon EC2 Request Instances
  17. Enter a name for your key pair, again doesn't really matter what you put, and then hit "Create and Download your Key Pair". Put this somewhere on your computer where you can find it easily. I put it in my Documents folder.
  18. Amazon EC2 Request Instances On the next page, since your going to be running a website, you need to allow all ssh, http and https traffic. Just use the drop down to select `ssh`, `http` and `https` and leave the source as `` Amazon EC2 Request Instances
  19. After this, your all ready. Go ahead and hit launch.
  20. Once it says your instance is running and you hit close, you will be on this page:
  21. Amazon EC2 Launch Instance
  22. For the next part, click on the row that you see your instance on. This will populate some information in the area below. If you scroll down in this area a little bit you will see a section called "Public DNS" and it will have a url like this `""`. This is the url to your website/linux box.
  23. Now your going to need to `ssh` into your linux box to get things setup. In order to do that, open up Terminal (Mac default) or whatever SSH client you have and type in the following:
  24. ssh -i ~/Documents/AmazonKey.pem
  25. Now your in! From here you can now install Ghost.

Install Ghost

  1. Update the operating system:
  2. sudo yum update
  3. Install C compiler
  4. sudo yum install gcc
    sudo yum install gcc-c++ compat-gcc-32 compat-gcc-32-c++
  5. Install node.js
  6. wget
    tar -xzf node-latest.tar.gz
    cd node-directory
  7. Use the following commands to compile and install node.js
  8. ./configure  
    sudo make install
    sudo ln -s /usr/local/bin/node /usr/bin/node
    sudo ln -s /usr/local/bin/npm /usr/bin/npm
    sudo ln -s /usr/local/bin/node-waf /usr/bin/node-waf
  9. Download and install Ghost
  10. mkdir -p /var/www/
    cd /var/www/
    unzip -d ghost [Ghost file you downloaded]
    cd ghost/
    sudo /usr/local/bin/npm install --production
  11. Configure and start Ghost
  12. sudo vim config.example.js

    Under the "Default Configuration" section

    change "host:"
    change "port:" to port 80

    Create Ghost User

    useradd ghost
    sudo passwd ghost

    Create a password

    chown -R ghost:ghost /var/www/ghost/

    Now to start Ghost, you will need to log into your "ghost" user.

    su - ghost
    cd /var/www/ghost/

    Now that you are logged in with your "ghost" user you can start Ghost:

    npm start --production

    Now go to your amazon URL and Ghost is up! Go to to setup your admin user and you have a free Ghost install!

    Possible Errors:

    1. Permissions 0777 for '/Documents/AmazonKey.pem' are too open. It is recommended that your private key files are NOT accessible by others. This private key will be ignored.
    sudo chmod 600 ~/Documents/AmazonKey.pem