Create a Professional Blog with AWS and Ghost
A professional blog is a great way to showcase your projects and knowledge in a consolidated place.
There are a plethora of blog options to choose from, including Medium, Blogger, Tumblr, Wordpress, and many more. When I created my blog I decided to explore my options. I eventually landed on The Ghost Blogging Platform for various reasons, but mostly because it’s open source and maintained by rad dudes.
Hosting your own professional or personal blog with Ghost may be a bit more work than the likes of Blogger or Tumblr, but it is rewarding and gives you better control over your environment. After I decided to use Ghost as my blogging platform, I needed to find a way to host my blog. I chose to use a micro-instance provided by Amazon AWS.
Coincidentally, searching the Amazon AWS Marketplace I encountered several pre-packaged AMI’s that were AWS EC2 instances with Ghost pre-installed. After a bit of research, I decided to use Bitnami’s Ghost powered EC2 instance. In this guide, I will show you how to:
- Spin up a Bitnami powered EC2 instance that has Ghost pre-installed
- Install a new theme for your Ghost blog
- Set up a custom domain for your blog
Set Up the AWS EC2 Instance
First, you need to create an AWS account with Amazon if you don’t have one already. Once completed, we need to do a bit of pre-work for the new host that will run the blog. We need to create a key pair for the EC2 instance so we can easily connect to it later on in the tutorial. To do this, log into the AWS management console, click on “EC2” which should be in the “Compute” section:
After you click “EC2”, navigate to the “Key Pairs” section which should be in the left side navigation column:
In the following screen, create a new key pair by clicking the blue button that says “Create Key Pair”. You can name it whatever you desire. We named ours “Bloc”. The new key pair will show up in the list once it’s created.
Now that we have created a new key pair for our blog, we need to actually create the host on which Ghost blog will run. Navigate to the AWS Marketplace. In the search box, search for “Ghost”. You will see a list of pre-built EC2 instances to choose from. We want the one that is called “Ghost powered by Bitnami”:
Click the blue Select button, and on the following screen click the “continue” button. In the resulting screen we have the ability to customize our instance. There are only two settings we want to verify on this screen. The first is the “EC2 Instance Type”. We want “t2.micro”:
The next setting we want to verify is the key pair that the instance is using. We want to set it to the key pair we created earlier; our key pair was named “Bloc”:
After those are set properly, click the “Launch with 1-Click” button. You now have a free, working, and soon to be running EC2 instance with Ghost pre-installed for one year. Verify this by navigating to “Instances” in your AWS management console. You should see your new instance in the list of running instances:
You should now be able to navigate to your Ghost blog by finding the public IP address or the Public DNS of the EC2 instance record above, and putting it in the URL locator bar in your browser. You should be greeted with the default Bitnami Ghost HTML page.
You’ll want to remove the default post that Bitnami provides and configure the settings in your new Ghost instance. Ghost makes this task trivial by allowing you to modify settings directly from their web interface. To do so, go to Ghost’s admin page for your instance by typing in your public IP address with “/admin” appended:
You will be presented with a login screen. You will need to enter in the default Bitnami username and retrieve the password from your EC2 instances’ log files. The username is:
The password was generated automatically by the EC2 instance and we need to retrieve it from the Ghost log files. Go back to the EC2 Management console, select your EC2 instance and go to Actions > Instance Settings > Get System Log:
Find the line in the log that says, “Setting Bitnami application password to”:
You’ll need to copy and paste this password into the Ghost admin login page in order to log in. After you log in with the default username and auto-generated password, the first thing you’ll want to do is set the login email address with a new password that you can remember. You can do this by clicking the dropdown in the top right corner of Ghost that says “email@example.com”.
From there, you can customize settings such as your blog title, description, logo, banner, and much more.
Setting up Custom DNS
In order to configure a custom DNS name for your new blog, you will need to purchase a domain name. You can use services like Namecheap to purchase and configure your domains:
Once you decide on a domain provider, create your domain. You will need to set up a new DNS “A” record. In Namecheap, we do this by setting @ and www to point to our IP address.
You will also need to change the URL in Ghost’s config.js file. To change the URL, connect to your EC2 instance directly using SSH. You will need a copy of the key pair for your EC2 instance on your local machine. AWS provides instructions on how to do this from the AWS management page by selecting the EC2 instance you want from your list of EC2 instances and selecting “Connect”:
You can use Terminal on OS X to connect to your EC2 instance. Terminal is located under Applications > Utilities > Terminal. Copy and paste the SSH command above to connect to the EC2 instance. Once you have successfully connected to your EC2 instance, open up the config.js file using an editor such as VIM on the command line:
Find the “config” section, and under this section find the “production” section. Here, you will need to change the URL to the domain of your blog:
Save the file and close it. Now, restart Ghost by issuing the following command:
sudo /opt/bitnami/ctlscript.sh restart ghost
Installing a New Theme for Ghost
Installing a new theme for Ghost is easy. Simply copy the theme to the themes directory:
Restart Ghost, then go to your admin panel in Ghost and select the theme:
Select Save and your new theme should appear after a refresh. If it has problems rendering, try restarting Ghost from the command line again.
Hosting your own blogging platform is fun to tinker with, but taking it one step further and telling someone that you created the software that hosts your blog is even more impressive. I am a Curriculum Developer for Bloc where I do a lot of reading, writing, coding, and figuring out how to help our students. If you found this guide useful and want to learn how to be technically proficient, check out our Web Developer Track or our Full Stack Web Developer Program.