How to Set Up a Ghost Blog in AWS including a CDN ($6/month) (2022)

August 19, 2021 · 10 min read

How to Set Up a Ghost Blog in AWS including a CDN ($6/month) (1)

Here I’m going to show you how you can install a Ghost blog using AWS Lightsail, set up a CDN for high performance, and handle traffic spikes without a problem from $6 per month.

First, I’m assuming you are familiar with Ghost, just in case, it’s an open-source blogging platform. I like its architecture. It’s decoupled; therefore, removing the parts you are not interested in and replacing them is easy. From their official docs, these are the parts in the system:

How to Set Up a Ghost Blog in AWS including a CDN ($6/month) (2)

For simplicity in this post, I will focus on setting up all parts in a dedicated VPS instance in Amazon Lightsail. It is the easiest way to get started with AWS for developers. Lightsail provides developers with compute, storage, and networking capacity and capabilities to deploy and manage websites and web applications in the cloud. The pricing of these VPS is similar to a three year reserved EC2 instance without the commitment. It’s a competitor service to Digital Ocean.

1. Creating the VPS with Ghost Blog

To create the server or instance as it’s called in the AWS ecosystem, navigate to AWS Lightsail, select the “Instances” tab, and click on “Create instance”.

How to Set Up a Ghost Blog in AWS including a CDN ($6/month) (3)

In the next screen, you can select in which region you want to base your server. As the server’s type of operating system image, I choose a Linux server with Ghost and its dependencies installed by default. Bitnami creates the server image, and you can see the documentation for it on their website. As the default tech stack installed in the server, we have Apache HTTP server, Maria DB, Node.js and Ghost Blog.

How to Set Up a Ghost Blog in AWS including a CDN ($6/month) (4)

For this demo, I’m selecting the smallest VPS on offer. We are also adding a CDN in front of the primary server. You don’t need a larger instance unless you have many editors or other specific needs.

How to Set Up a Ghost Blog in AWS including a CDN ($6/month) (5)

Scroll to the bottom of the page and click on “Create instance”.

How to Set Up a Ghost Blog in AWS including a CDN ($6/month) (6)

You will see that the new instance is being created.

How to Set Up a Ghost Blog in AWS including a CDN ($6/month) (7)

And after a few minutes, you will see it’s in the “running” state. Click on the instance name to navigate to the details.

(Video) Install, Host & Publish Ghost Blog on AWS EC2 Instance FREE - With SSL Certificate in 20 minutes!

How to Set Up a Ghost Blog in AWS including a CDN ($6/month) (8)

In this screen, you can see the public IP, and you can also connect to the VPS using SSH from the website, so you don’t need to use your terminal or putty to connect to the instance. Go ahead and click on “Connect using SSH” so we can find out the logging details for the Ghost admin panel.

How to Set Up a Ghost Blog in AWS including a CDN ($6/month) (9)

Once you are in the terminal, you just need to type cat bitnami_application_password and that will show your access password. The default user is user@example.com.

How to Set Up a Ghost Blog in AWS including a CDN ($6/month) (10)

Now you can open the default homepage by navigating to http://PUBLIC_IP. In my case, that is http://54.242.66.221.

How to Set Up a Ghost Blog in AWS including a CDN ($6/month) (11)

Now you can open the admin panel by navigating to http://PUBLIC_IP/ghost. In my case, that is http://54.242.66.221/ghost, and enter your credentials to log in.

How to Set Up a Ghost Blog in AWS including a CDN ($6/month) (12)

Once you are logged in to the dashboard, you can edit, delete or create new content in pages and blog posts. And change settings or configure integrations for your blog.

How to Set Up a Ghost Blog in AWS including a CDN ($6/month) (13)

2. Configure Email

In Ghost, you can send two types of email:

  • Transactional: user invitations, password resets, member signup and member login links.
  • Newsletters to your subscribers: only supports Mailgun to send emails in bulk to guarantee deliverability. There are workarounds to use other email providers too. You can find more details about the reasons behind using Mailgun.

By default, Ghost uses Nodemailer to send emails. And by default, Sendmail is the transport layer, but it’s not installed on our server. I recommend you use an external SMTP server for a higher deliverability rate. It can be AWS SES, Gmail, or Mailgun if you are interested in using the Newsletters feature as well.

To update the email configuration details, connect via SSH to the server again. The ghost configuration file location path is /opt/bitnami/ghost/config.production.json

You can edit it using your favourite text editor, I will use VI. Type the command $ vi /opt/bitnami/ghost/config.production.json, and find the lines:

 "mail": { "transport": "Direct" },
(Video) Ghost.org Complete Tutorial - Turn Your Blog into a Subscription Business

If you want to use Gmail, you can replace the previous 3 lines, with the following code block, replacing your user/password:

 "mail": { "service": 'Gmail', "transport": 'SMTP', "options": { "host": 'smtp.gmail.com', "port": 465, "secureConnection": true, "auth": { "user": 'XXXXXXX@gmail.com', "password": 'XXXXXXXXX' } } }

If you are using Mailgun, then use the following code-snipet, replacing your user/password:

 "mail": { "transport": "SMTP", "options": { "service": "Mailgun", "host": "smtp.mailgun.org", "port": 587, "auth": { "user": "postmaster@sandbox2b6ff9d855f54e4387ee55962ba55215.mailgun.org", "pass": "d995a43582a6bcff242c67de755df5e1" } } },

You can get your Mailgun config details from the dashboard after you have logged in to your account:

How to Set Up a Ghost Blog in AWS including a CDN ($6/month) (14)

After you have updated your email configuration details, restart Ghot by running in your server console sudo /opt/bitnami/ctlscript.sh restart ghost.

3. Configuration for Email Newsletters

To start sending out bulk emails, you will need to provide your Mailgun API key to Ghost. Navigate to the Mailgun dashboard, select API Keys, and copy the key.Then in your Ghost admin dashboard, go to Settings -> Email newsletter -> Email newsletter settings and click on expand. Paste the Mailgun Domain and Mailgun API key.

How to Set Up a Ghost Blog in AWS including a CDN ($6/month) (15)

That is all you need to send out newsletters and transactional emails from your Ghost blog.To test that sending emails work, you can select Stuff from the Ghost dashboard menu, then in the top right, click on Invite people, to try to send emails through Ghost.

4. Add a CDN for Increased Speed and Low Latency

CDNs offer an easy way to increase the speed of a website while also lowering the latency. Therefore, they are essential for the fast, efficient and secure delivery of content to worldwide users. With website visitor attention spans growing shorter by the day, delivering this content as quickly as possible is imperative.

Up until this point, we have accessed the server always via its static IP. Once we create our CDN, we will have a domain name. And traffic to the CDN will be over HTTPS, and the CDN will act as a reverse proxy that will communicate to our server using HTTP. Luckily we can host Ghost behind a reverse proxy without a problem, but we need to pass a few additional headers to avoid getting inside an infinite loop where Ghost thinks that we’re not using SSL. We’re going to set up as part of this configuration.

To create the CDN, from your Lightsail dashboard, navigate to the Networking tab, and click on Create distribution:

How to Set Up a Ghost Blog in AWS including a CDN ($6/month) (16)

In this form, we configure how we want the CDN to behave, to start with, I’m selecting the Ghost server as origin. That means that the traffic that the CDN will route the traffic to Ghost and it will cache it.

How to Set Up a Ghost Blog in AWS including a CDN ($6/month) (17)

(Video) Ghost Blog Tutorial | Getting Started With Ghost

If we scroll down to the Caching behaviour section, select the option Best for WordPress, then click on the link Show all settings. Go to Directory and files overrides section, and you can delete those two caching behaviours for the folders “wp-includes” and “wp-content”. You can do that by clicking on the bin icon to the right. I am interested in the Advanced cache settings section below, but I couldn’t find any other way to access it. Maybe this is fixed in a future update.

How to Set Up a Ghost Blog in AWS including a CDN ($6/month) (18)

Now, click on the edit button next to “…forward the HTTP headers I specify” section. And add the options X-Forwarded-Proto / X-Forwarded-For, as shown in the screenshot below. As mentioned below, we’re passing these headers to not get into an SSL redirect loop.

How to Set Up a Ghost Blog in AWS including a CDN ($6/month) (19)

Keep scrolling down, to give a name to the CDN distribution, and click on Create distribution to finish.

How to Set Up a Ghost Blog in AWS including a CDN ($6/month) (20)

You will be redirected to the CDN details screen, where you can see that it’s being created on the top right. It normally takes 5 to 10 minutes.

How to Set Up a Ghost Blog in AWS including a CDN ($6/month) (21)

Notice that we’re also getting a domain name for the distribution in the form of “https://.cloudfront.net”. So we need to update Ghost to recognize that host as the domain for the blog. Connect via SSH into the server, edit your config.production.json “and in the line where the public URL for the blog is specified, enter your CDN public URL, in the form **“https://.cloudfront.net”**. Later, after we set up a custom domain name, we will update it again.

Enable SSL

We’re enforcing HTTPS from the CDN; we also need to edit Apache’s configuration to pass the headers specified earlier in the CDN. Edit the Apache’s configuration file by running the command in the server terminal:

sudo vi /opt/bitnami/apache2/conf/httpd.conf

Find the block , and add RequestHeader set X-Forwarded-Proto "https", as shown below:

<IfModule headers_module> # # Avoid passing HTTP_PROXY environment to CGI's on this or any proxied # backend servers which have lingering "httpoxy" defects. # 'Proxy' request header is undefined by the IETF, not listed by IANA # RequestHeader unset Proxy early RequestHeader set X-Forwarded-Proto "https"</IfModule>

After updating the domain and SSL config, remember to restart Ghost and Apache:

sudo /opt/bitnami/ctlscript.sh restart ghostsudo /opt/bitnami/ctlscript.sh restart apache

Now you can navigate to your blog and admin panel using your CloudFront domain name.

(Video) Start a Blog with Ghost CMS and Digital Ocean for Only $5 a Month!

5. Use a Custom Domain Name

The next step after having the CDN created is to use my domain name. To set it up, from the Lightsail dashboard, select the Networking tab, then click on your CDN-Ghost distribution, and select the ”Custom domains” tab.

As you can see, the toggle to enable my custom domain is disabled because I don’t have a valid SSL certificate, and I’m enforcing SSL traffic through the CDN. So I will create a certificate by entering the domain name that I want to use, giving it a name, and clicking on the Create button.

How to Set Up a Ghost Blog in AWS including a CDN ($6/month) (22)

We need to validate that we own the domain name, so we need to add an entry to the DNS table. That might differ depending on which domain provider you have, but it’s pretty standard, and you need to add a CNAME entry, as is shown in the screenshot.

How to Set Up a Ghost Blog in AWS including a CDN ($6/month) (23)

After you create the CNAME entry, the domain will be valid but not in use.

How to Set Up a Ghost Blog in AWS including a CDN ($6/month) (24)

So we can associate the custom domain to the CDN now. Lastly, don’t forget to create another CNAME entry from the domain name to CloudFront. In my case, it’d be something like:

ghost.pedroalonso.net CNAME ********.cloudfront.net

How to Set Up a Ghost Blog in AWS including a CDN ($6/month) (25)

Now I can navigate to my self-hosted Ghost blog using my custom domain, using HTTPS and having a CDN in case any blog post becomes viral; it can cope with the load successfully!

6. Ghost Integrations

At this point, probably you will want to set up some analytics, i.e., Google Analytics or Matomo. Also, you might be interested in hearing feedback in the form of comments from your readers; it’s easy to integrate Disqus in Ghost.

I would also like to mention that there are many integrations with 3rd party websites by default in the Ghost editor. So you can use images from Unsplash for your posts very quickly. It’s also effortless to embed videos from YouTube or Tweets from Twitter. You can also embed PayPal Payment Buttons or even custom HTML. So if you want to do something not supported by default, look at the extensive list of integrations.

RELATED POSTSGhost, Blog, AWS

  • WordPress, Ghost and NodeJs on your own PAAS with CapRover ($5/month)
  • Hosting PostgreSQL on a t4g Graviton2 ARM Instance on AWS EC2
  • Professional WordPress Setup in AWS Lightsail From $6 per Month
  • Automate the Deployment of PostgreSQL to EC2 ARM Using Terraform
How to Set Up a Ghost Blog in AWS including a CDN ($6/month) (26)
(Video) Hosting a Ghost website costs time or money

Software developer and consultant. I help companies build great products. I've worked with all kinds of companies. Contact me by email.

FAQs

How do I create a ghost blog on AWS? ›

Prerequisites
  1. Create a new EC2 Instance. First of all, if you haven't yet, create an AWS account. Ghost requires an Ubuntu LTS version later than 16.04. Therefore, we are launching a t2. ...
  2. Register a domain name. We need a domain name to host our new blog. You can buy it from any domain registrar of your preference.
Feb 19, 2021

What is ghost image in AWS? ›

Up-to-date and secure image. Ghost is an open source publishing platform designed to create blogs, magazines, and news sites. It includes a simple markdown editor with preview, theming, and SEO built-in to simplify editing. Linux/Unix. 6 AWS reviews.

Which AWS service provides preconfigured virtual private servers instances that include everything required to deploy an application or create a database? ›

Amazon LightSail provides preconfigured virtual private servers (instances) that include everything required to deploy and application or create a database. The underlying infrastructure and operating system is managed by Amazon LightSail.

Is AWS Lightsail free? ›

As part of the AWS Free Tier, you can get started with Amazon Lightsail for free. Sign up and receive one year free of 50 GB content delivery network (CDN) distributions, one year free of a 5 GB object storage bundle, and three months free on select container, instance, and database bundles.

How do I install ghost on AWS? ›

If instructions aren't working, and you figure out how to get things to work again, PRs are welcome to fix this up.
  1. EC2 setup. ...
  2. Connect to the instance. ...
  3. Follow Ghost's Guide. ...
  4. Create an Elastic IP. ...
  5. Set up your domain. ...
  6. Set up email (optional) ...
  7. Reserve your instance. ...
  8. Set up EBS backup.

What is Ami in AWS? ›

An Amazon Machine Image (AMI) is a supported and maintained image provided by AWS that provides the information required to launch an instance. You must specify an AMI when you launch an instance. You can launch multiple instances from a single AMI when you require multiple instances with the same configuration.

How do you set up a ghost? ›

How to Install Ghost - YouTube

What is Amazon hypervisor? ›

A hypervisor is a piece of system software that provides virtual machines (VMs), on which users can run their OS and applications. The hypervisor provides isolation between VMs, which run independent of each other, and allows different VMs to run their own OS.

What is the easiest way to launch and manage a virtual private server in AWS? ›

Lightsail is designed to be the easiest way to launch and manage a virtual private server with AWS. Lightsail plans include everything you need to jumpstart your project – a virtual machine, SSD-based storage, data transfer, DNS management, and a static IP – for a low, predictable price.

Which service can you use to provision a preconfigured server with little to no AWS experience? ›

Which service can you use to provision a preconfigured server with little to no AWS experience? Deploying a server on Lightsail is extremely easy and does not require knowledge of how to configure VPCs, security groups, network ACLs etc.

Which security features are within Amazon Virtual Private Cloud VPC )? Select all responses that apply? ›

Amazon Virtual Private Cloud (Amazon VPC) provides the following features that let you increase and monitor security for your VPC.
  • Flow Logs. ...
  • IP Address Manager (IPAM) ...
  • IP Addressing. ...
  • Ingress Routing. ...
  • Network Access Analyzer. ...
  • Network Access Control List. ...
  • Reachability Analyzer. ...
  • Security Groups.

Which is cheaper EC2 or Lightsail? ›

EC2 pricing. Amazon Lightsail costs are lower for basic resource usage compared to the On-Demand Instances in EC2. In terms of Linux/Unix, the smallest Lightsail instance, with 512 MB of RAM and 20 GB of SSD storage, is $3.50 per month.

Which is better EC2 or Lightsail? ›

Amazon EC2 is a mix of multiple services and has its own individual features used to create a single architecture. Amazon EC2 instances are meant for small to complex architecture. Lightsail, on other hand, is an integrated product of services offered by AWS. Lightsail is better for small to medium scale workloads.

What happens after 12 months of AWS free tier? ›

When your Free Tier period with AWS expires, you can continue to use services or stop using services. If you continue using AWS services, then all resources on your account are billed at On-Demand rates.

What are the two types of AMI? ›

Amazon Machine Images (AWS AMI) offers two types of virtualization: Paravirtual (PV) and Hardware Virtual Machine (HVM). Each solution offers its own advantages. When we're using AWS, it's easy for someone — almost without thinking — to choose which AMI flavor seems best when spinning up a new EC2 instance.

Does AMIs money cost? ›

You are only charged for the storage of the bits that make up your AMI, there are no charges for creating an AMI. EBS-backed AMIs are made up of snapshots of the EBS volumes that form the AMI. You will pay storage fees for those snapshots according to the rates listed here.

What is the difference between AMI and instance? ›

An Amazon Machine Image (AMI) is a template that contains a software configuration (for example, an operating system, an application server, and applications). From an AMI, you launch an instance, which is a copy of the AMI running as a virtual server in the cloud.

How do I host a Ghost blog? ›

Let's set up a brand new Ghost blog in 16 easy steps!
  1. Buy a Domain Name. Before anything else can happen, you need your own domain. ...
  2. Get Remote Access Tools. ...
  3. Get Hosting Space. ...
  4. Test Access to Your Droplet. ...
  5. Add Your Domain to DigitalOcean. ...
  6. Change Your Nameservers with Your Registrar. ...
  7. Wait. ...
  8. Prepare Server.
Sep 6, 2017

How can I host a Ghost blog for free? ›

Ghost blog for $0 / mo

DigitalPress is really free. Our ambition is to enable everyone to tell their story without having to think about price. Create and edit content at no cost. Our free plan includes variety of themes and design layouts to show your style.

How can I create a Ghost website? ›

Ghost.org Complete Tutorial - Turn Your Blog into a Subscription ...

What is EC2 stands for? ›

Amazon Elastic Compute Cloud (Amazon EC2) provides scalable computing capacity in the Amazon Web Services (AWS) Cloud.

How many EC2 instances do I need? ›

One thing to note is that your account EC2 instance limits should be set to more than 20 instances per region, otherwise you could end up being unable to launch new instances when you most need them.

How many EC2 instances can I run free? ›

Your free usage under the AWS Free Tier is calculated each month across all regions and automatically applied to your bill. For example, you will receive 750 Amazon EC2 Linux Micro Instance hours for free across all of the regions you use, not 750 hours per region.

How do I create a virtual private network on AWS? ›

Creating a Virtual Private Cloud (VPC)
  1. In the navigation pane of the Amazon VPC Management console, choose Security Groups.
  2. Choose Create Security Group.
  3. Type a name and a description for your security group in the corresponding boxes. ...
  4. When the settings are as you want them, choose Yes, Create.

Does Amazon provide free VPS? ›

As an incentive to use their service, Amazon Web Services offers new users a “free tier” of service that provides a VPS “micro-instance” at no cost for one year.

How do I setup a virtual network on AWS? ›

Sign in to the AWS Management Console, and open the Amazon VPC console at https://console.aws.amazon.com/vpc/ . In the VPC dashboard, choose Create VPC. Under Resources to create, choose VPC and more. Under Number of Availability Zones (AZs), choose the number of Availability Zones you want to launch your subnets in.

Which AWS service or feature allows users to connect with and deploy AWS services programmatically? ›

AWS CodeDeploy fully automates your software deployments, allowing you to deploy reliably and rapidly. You can consistently deploy your application across your development, test, and production environments whether deploying to Amazon EC2, AWS Fargate, AWS Lambda, or your on-premises servers.

Which AWS networking service enables a company to create a virtual network within AWS? ›

Amazon VPC enables you to build a virtual network in the AWS cloud - no VPNs, hardware, or physical datacenters required. You can define your own network space, and control how your network and the Amazon EC2 resources inside your network are exposed to the Internet.

What AWS tool lets you explore AWS services and create an estimate for the cost of your cases on AWS? ›

AWS Pricing Calculator is a web-based planning tool that you can use to create estimates for your AWS use cases. You can use it to model your solutions before building them, explore the AWS service price points, and review the calculations behind your estimates.

Which AWS services can be used to store files Choose 2 answers from the options given below? ›

Amazon Simple Storage Service (Amazon S3) Amazon Elastic Block Store (Amazon EBS) Amazon Athena.

Videos

1. Ghost Blog Tutorial : Get Hosted For FREE : 1 click install
(No Code Nomad)
2. How to install a Ghost Blog using AWS EC2
(NovelTech Media)
3. Install and Configure the Ghost Blog in 5... err... 10 Minutes
(Codepunk)
4. Getting Started with Ghost (self-hosted): Beginner Edition!
(Jessica Deen)
5. Self Hosting a blog using AWS, EC2, S3, Ghost, Commento, and Goaccess: My Journey
(Daniel Markham)
6. Deploying Ghost to AWS with EC2 & RDS ft Sam Julien - Colbyashi Maru
(Colby Fayock)

You might also like

Latest Posts

Article information

Author: Msgr. Refugio Daniel

Last Updated: 10/27/2022

Views: 5367

Rating: 4.3 / 5 (54 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: Msgr. Refugio Daniel

Birthday: 1999-09-15

Address: 8416 Beatty Center, Derekfort, VA 72092-0500

Phone: +6838967160603

Job: Mining Executive

Hobby: Woodworking, Knitting, Fishing, Coffee roasting, Kayaking, Horseback riding, Kite flying

Introduction: My name is Msgr. Refugio Daniel, I am a fine, precious, encouraging, calm, glamorous, vivacious, friendly person who loves writing and wants to share my knowledge and understanding with you.