It’s a combination of two logos. Don’t think about it too hard.

Creating a simple website with a custom domain on Amazon Lightsail + Docker

Article Organization

  • Who is this article really for?
  • How to read this article.
  • What will be made?
  • The actual walkthrough
  • A brief explanation on “Why Amazon Lightsail and Docker?”

Who is this article really for?

How to read this article

What will be made?

It’s not the prettiest, but that’s not the point.

The Actual Walkthrough

  • An account with Amazon Web Services.
  • A custom domain (I’ll be using Namecheap for the last few steps, but the steps themselves should be easily replicated with other registrars). If there is enough interest in other registrars, I may provide additional tutorials.

Step 1 — Create an Amazon Lightsail instance

  1. On the main Lightsail Instances page, click Create Instance.
  2. Select Linux/Unix as your platform
  3. Select OS Only as the blueprint filter
  4. Select Ubuntu as the blueprint
  5. Select whatever plan you want (notice that you can try out a plan for free for one month for up to 750 hours)
  6. Name your instance (I like to append its purpose at the end, such as the _app in my instance’s name)
  7. Click Create
  8. Woo! You just created a Lightsail instance.

Step 2 — Install Docker

The version of Docker is highlighted at the end of this GIF.
The terminal button is in the dotted red box.
https://gist.github.com/JoshuaTheMiller/c8203dfd4c9b423401d52692222b499b
  1. Copy whatever it is that you wish to paste.
  2. In the lower right hand corner of the terminal, click the clipboard icon.
  3. Paste what you copied into the space that is presented.
  4. Click back into the terminal.
  5. Right click on the terminal to paste into it.
  6. Hit enter to execute your pasted command.

Step 3 — Setup a container

https://gist.github.com/JoshuaTheMiller/8d3ef20a26b46eb92a7482ecb1624a3f
  1. It tells Docker we’re going to try and create a container using my SimpleWeb docker image (trfc/simpleweb).
  2. The --rm option signals that this container should be removed when it exits/stops.
  3. -d, which is short for the--detach, causes this container to be ran in the background. It also causes the container’s ID to be printed to the console when the command is ran.
  4. -p, which is short for --publish, publishes a container's port(s) to the host (I’ve seen this be referred to as being short for --ports,which is incorrect but makes some sense). Here, we are binding our host’s (the VM’s) port 80 to the container’s port 80 as that is the default port for HTTP traffic.
  5. The--name option is passed and set to simple so that the container’s “names” field is set to “simple.”

Step 4 — Quick Test

  1. Go back to the Lightsail dashboard.
  2. Notice that there is an address listed below the terminal button from before.
  3. Follow that address.
  1. Go back to the Lightsail dashboard.
  2. Click on the instance you created.
  3. Find the Public IP.
  4. Copy the address displayed underneath and paste it into your browser. You should be taken to a page that looks like the image from the earlier section “What will be made?” (disclaimer: I’m not worried about exposing the various addresses that are shown as my demo instance is very temporal).

Step 5 — Setting up your static IP address

A Static IP is a fixed, public IP address that you can always rely on to be the same. ~ Amazon

  1. Go back to the Lightsail dashboard.
  2. Click Networking.
  3. Click Create a static IP.
  4. Attach it to the Lightsail instance you created.
  5. Name it something, I called mine supersimplesite_staticip.
  6. Click Create.

Step 6— Setting up your custom domain

  1. Click Networking.
  2. Click Create DNS zone.
  3. Enter the domain you have registered/own in the box titled, “Enter the domain you have registered.”
  4. Click Create DNS Zone.
  5. Under DNS records, add an A record (you can add more later). For this initial record, just write in your bare domain (no www). For the Destination IP, Lightsail is nice and presents you with autofill options. Make sure to choose the static IP resource that you just created.
  6. Click Save to save your DNS Records changes.
  7. Do not close this page as we will be copy/pasting the Nameserver addresses that are listed at the bottom of it.
  1. Click “Manage” for the site that you are using for this tutorial.
  2. Find the row labelled Nameservers and change the selection from Namecheap BasicDNS to Custom DNS.
  3. Add two more nameserver rows by clicking Add Nameserver.
  4. One by one, copy and paste the nameservers from your Lightsail page on the nameserver rows in Namecheap. Make sure to copy all of the nameservers listed on Lightsail.
  5. Click the little green check-mark to signify that you are done.

Step 7 — Wait and Verify

Why Amazon Lightsail and Docker?

Lightsail provides developers compute, storage, and networking capacity and capabilities to deploy and manage websites and web applications in the cloud. Lightsail includes everything you need to launch your project quickly — a virtual machine, SSD-based storage, data transfer, DNS management, and a static IP — for a low, predictable monthly price.

Ending Statements

--

--

Just a guy trying to share some knowledge about various topics that he finds interesting.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Joshua Miller

Just a guy trying to share some knowledge about various topics that he finds interesting.