Set up a modern, scalable website in AWS & DigitalOcean

I’ve managed websites for years. I started in the world of cheap PHP web hosts, where a few bucks per month will get you some space on a shared cPanel server. Later, I upgraded to my first virtual private server (VPS) where you have more control over what runs your website, but also more responsibility in managing it correctly. Today I use a variety of different cloud services, combining serverless file storage platforms like Amazon S3, with cloud servers running the actual web apps themselves (such as wordpress). I’m writing this tutorial to discuss how I set up my websites, so that others who are interested in the same things can give it a try as well.

Keep in mind that this tutorial is not for the faint of heart. I’m targeting this towards people who have some experience on a command line, or in running sites. If you want to set up something quick and cheap as a consumer, I recommend SquareSpace. You won’t have to worry about servers, or any of that business. But you will be severely limited in what you can do, which is why I recommend an approach like the one outlined in this post for anyone who wants to set up a site and knows their way around a command line.

Choosing your software

Your first choice in creating a website is to choose the software that you want to run. I’m talking a blogging platform like WordPress, or a community platform like Discourse. There are all sorts of choices here, depending on what you want to do. Many websites, such as my upcoming science website, will need to use multiple such systems. If you want your website to have a blog, a forum, and an online store, then you either need to use several separate systems, or you need to pick one very powerful system that can do all of these things.

A few of my recommendations are:

There are many others out there, though. My recommendation is to go with an open source option, unless a paid one is clearly better. For most needs, wordpress is an excellent starting point. I’ll cover setting up wordpress in this post specifically.

Launching a server instance

You’ll need a server to host your wordpress site (or other web apps you choose to set up). While offers free wordpress hosting, setting up on your own server will offer more control, and let you host your own ads instead of theirs. Even their paid plans cost about as much as running it yourself.

Before launching your server, you will need to choose a service provider. I recommend two hosts, DigitalOcean and Amazon EC2. Both of these have comparable pricing, with Amazon offering a limited free tier for the smallest servers, and with DigitalOcean running a bit cheaper at the entry level ($5 versus $7 per month). I will use DigitalOcean in this tutorial, as they have served me well for four years, and their interface is also a lot simpler.

First, go to and create an account. You’ll end up in their cloud control panel, which lets you launch droplets, their name for a cloud server. EC2 instances and droplets are basically the same thing, minus branding.

Choose one-click-apps. For this tutorial, we’ll use WordPress. I’ve also used their Discourse launcher, which works well. If you’re installing something more complicated like xenForo, I recommend using either the LAMP one-click, or one of the control panels, such as CyberPanel or Plesk. These offer a one-stop interface to set up websites, mail, dns, ftp, etc. on your server. While these are often convenient, I recommend against them for simpler sites, as the kitchen sink is often not needed, and running your own mail and DNS is usually a bad idea.

For instance size, choose the smallest. Unless you have very grand plans for your site right out of the gate, 1 GB memory and a terabyte of bandwidth will be quite enough. You can always scale your instance later. That is the benefit of cloud hosting.

Next, you’ll probably want backups, unless you plan to set up a separate backup system at the application layer (such as a wordpress plugin that does backups. I’m sure there are dozens). Choose a datacenter close to either you or your users. We’re going to set up a CDN later to distribute the bulkier content across the world, so this is less important. Finally, you’ll want to set up an SSH key. That’s out of the scope of this tutorial, but it will let you log into the server very easily. Create one droplet, which is all you’ll need right now, and give it a hostname like

Click launch instance. While that’s creating, which will take about a minute, let’s talk about domain names.

Domain names & DNS

Domain names aren’t the focus of this tutorial, and are perhaps a topic for another day. But if you don’t have a domain name yet, my recommendation is to register it from Their prices will run a few dollars more than the cheapest options, but their interface is nice, their support is good, they won’t try to up-sell you, and they offer nice things like DNS and whois privacy for no extra charge.

Once your droplet instance is created, you’ll need to copy its IP address, which can be found from a bunch of places in the digital ocean interface, including its homepage. Then, log into your domain registrar’s interface

You’ll want to set up an A record pointing to your server. If you want your domain root to point to it, such as and, add an A record for the hostnames @ and www pointing to your server’s IP. If you have multiple servers, with each running a different app, then you can set up multiple different A records. The default TTL in hover of 15 minutes is fine.

Installing WordPress & SSL

WordPress is easy to install. If you used DigitalOcean’s one-click-app setup, then just start by logging into your server with secure shell. It will immediately walk you through setting up SSL using Let’s Encrypt, which is free and easy. Just make sure to have your DNS set up before this step. Otherwise the Let’s Encrypt setup won’t work properly.

Once SSL is set up, you will be able to install wordpress by visiting your website in the browser. This part is pretty simple. Make sure to choose a secure password. I recommend LastPass as a password manager, instead of typing one in.

Once wordpress is set up, you technically have a working site. The next steps are optional, but I recommend them because it will make the site faster and more scalable.

Content delivery network for files

If your website has a large number of file uploads, there are several advantages to delivering files over a content delivery network. First, storage space on cloud servers is expensive. You don’t want to scale your server to a larger instance, with higher per month cost, for disk space alone. You want to scale it with traffic, because high traffic often comes with high revenue. Second, content delivery networks are faster and more reliable. You’ll want to put the strain of serving large files onto an external network, not your application server. That will let you run a smaller server, while still serving content more quickly and with greater reliability.

I recommend two services to distribute large file content. One is Amazon S3, which is a storage service that will store your files and make them available. The other is Amazon Cloudfront, which is a content delivery network. It will cache your Amazon S3 content, and instead of making it available slowly from one place, it will make it available more quickly from caches across the world.

Amazon provides better documentation for doing this than I ever could. To get started, I recommend reading this article from amazon. In essence, what you will need to do is:

  • Install a wordpress plugin to automatically offload files to S3. I recommend WP Offload Media Lite.
  • Create an Amazon S3 bucket to store your files, and set it up with your software.
  • Issue an SSL certificate using the AWS certificate manager. It’s free.
  • Create a Cloudfront distribution that points to the S3 bucket.
  • Set up your plugin to load images from that CDN.

And that’s it. It will probably take about 15-30 minutes, but once it is set up, it will work. And with S3 and Cloudfront, you pay for what you use. This is why I recommend it over DigitalOcean Spaces for new sites. With Spaces, you will be paying $5 a month at the entry level, but if you have only a few files, S3 and Cloudfront can provide you with the same service for pennies per month.

Total cost comparison

The cost of setting up a website with this method is $5 per month, per application. The $5 is in server fees. You’ll also need to register a domain, with costs about $13 per year, and pay for distribution costs in cloudfront, which will be based on usage.

Here is an example breakdown of the cost for a website with a WordPress blog and a Discourse forum.

  • WordPress droplet: $5 /month
  • Discourse droplet: $5 /month
  • DigitalOcean Backups: $2 /month
  • Domain name: $13 /year
  • S3 + Cloudfront: ~$1 /month
  • Total cost: $14.08 /month

For comparison, Discourse charges $100 /month for their paid hosting service, and charges about $5 /month for their mid-tier package. Squarespace pricing ranges between $12 and $26, depending on the plan. While you could probably go with cheaper options, this set up has a competitive price to software-as-a-service hosts, and is often cheaper.

I may write a post on the cheapest practical set up in future, which involves cheap PHP web hosts. But even then, you would only be saving a few bucks, at the cost of a great deal of scalability. This approach is affordable, and easy to scale. All you have to do is grow your droplet instances, which can be done through the digital ocean control panel. And the AWS CDN stuff will auto-scale without any effort.