GhostBlog deploying to Amazon Elastic Beanstalk t1.micro instance

The purpose of this article was to address issues I had come across when trying to deploy Ghost to AWS t1.micro instance. The ti.micro instance lacks the memory overhead and cpu priority to properly execute a server-side npm install. This resulted in server build errors including ENOENT.


Download the latest release of Ghost
run npm install --production
verify Ghost runs npm start


If you would like to have persistent storage, download and install ghost-s3-storage. Follow the instructions on creating the directory for Creating the storage module. The next step, we will cover how to configure this using environmental variables.


Create a folder to store Elastic Beakstalk with the name .ebextensions
.ebextensions contains configurable files that will allow you to override the .


  - option_name: NODE_ENV
    value: production
  - option_name: URL
  - option_name: IAM_ACCESS_KEY
    value: AK...
  - option_name: IAM_SECRET_KEY
    value: 5..8g
  - option_name: S3_BUCKET_NAME
    value: BUCKET NAME
  - option_name: S3_BUCKET_REGION
    value: us-east-1
   gcc: []
   gcc-c++: []
   openssl-devel: []

Second file is created to override some of the deployment processes 00_deploy_npm.config

  "/opt/elasticbeanstalk/env.vars" :
    mode: "000775"
    owner: root
    group: users
    content: |
      #export lines expose variables to other scripts
      export NPM_CONFIG_LOGLEVEL=error
      export NODE_PATH=`ls -td /opt/elasticbeanstalk/node-install/node-* | head -1`/bin
  "/opt/elasticbeanstalk/hooks/appdeploy/pre/" :
    mode: "000775"
    owner: root
    group: users
    content: |
      . /opt/elasticbeanstalk/env.vars
      #prevent running npm install during appdeploy
  "/opt/elasticbeanstalk/hooks/configdeploy/pre/" :
    mode: "000666"
    owner: root
    group: users
    content: |
       #no need to run npm install during configdeploy

Head on over to Caffeine Coding - Ghost on Elastic Beanstalk pt. 1 and read about setting up IAM Users and an S3 Bucket. Once you have created your bucket, update the environment.config values with the correct IAM_ACCESS_KEY, IAM_SECRET_KEY, and S3_BUCKET_NAME.


Due to the limits of t1.micro, we have to include all of node_modules during our deploy. The files will need to be zipped and then uploaded into Elastic Beanstalk.


In Amazon Elastic Beanstalk, create a new Node.js - Single Instance using RDS. Upload your new ZIP file. The instance should be available.

Final Thoughts

This was my first NodeJS script deployed to any public cloud. There was a lot of trial/error and lessons learned. In the end, this was the method that finally worked for me. I am now able to update my single instance and experiment with my template and code tweaks.

A big thanks to Caffeine Coding for their article on setting up GhostBlog for AWS. It was both current and very informative.

Here is the code source

Dev Simon

Read more posts by this author.