Skip to content

Deploy Hatamoto on Amazon EC2

By the end you have Hatamoto running on an Amazon EC2 instance with HTTPS, an Elastic IP that keeps your domain pointed at it, and a setup link in your SSH session. You paste one script into User data, then open ports 80 and 443 and attach the Elastic IP. Allow a few minutes after launch for the install.

A t3.micro is about $7.59 a month before the disk and the public IPv4 address, which AWS bills separately.

What it costs

Hatamoto needs 1 GiB of RAM, so t3.micro is the smallest instance that works. These are Linux on-demand prices in US East (N. Virginia), with a month as 730 hours.

ItemPrice
t3.micro: 2 vCPUs, 1 GiB RAM, amd64$0.0104 an hour, about $7.59 a month
t3.small: 2 vCPUs, 2 GiB RAM, amd64$0.0208 an hour, about $15.18 a month
t4g.small: 2 vCPUs, 2 GiB RAM, arm64$0.0168 an hour, about $12.26 a month
Public IPv4 address, auto-assigned or Elastic IP$0.005 an hour, about $3.65 a month
gp3 disk$0.08 per GB a month
Snapshots$0.05 per GB of snapshot data a month

Prices as of 13 November 2026, from AWS's published price list for EC2 and VPC. They change, so check the provider before you order.

Before you start

  • An AWS account, and the EC2 console at console.aws.amazon.com/ec2.
  • A domain you can point at AWS by editing its DNS, if you want a name of your own. Without one, Hatamoto serves a free sslip.io name that stops working when the address changes.
  • An email address that the certificate authority can write to about expiry.
  • A terminal with SSH, for the commands from step 8 onward.

Step 1: Start the wizard, name it and choose the image

Open the EC2 console. The navigation bar shows the Region: choose one near your visitors. On the EC2 dashboard, choose Launch instance. In Name and tags, type a Name such as hatamoto. Under Application and OS Images (Amazon Machine Image), choose Quick Start, then Ubuntu, and select the Ubuntu Server 24.04 LTS image.

Step 2: Choose the instance type and a key pair

Under Instance type, pick t3.micro. For arm64, pick t4g.small and make sure the image architecture is arm64. A t3.micro launched from the console defaults to Unlimited mode, which can add charges when the CPU is busy. Under Key pair (login), pick an existing key pair or choose Create new key pair. Give it a name, a Key pair type (RSA or ED25519) and the .pem format. Your browser downloads the private key once. Run chmod 400 on the file.

Step 3: Create a security group

In Network settings, check that Auto-assign Public IP is enabled. Under Firewall (security groups), create a new security group. AWS adds an inbound rule that lets any address connect over SSH, so narrow it to your own address if you can. Do not choose a VPC's default security group, which does not allow SSH.

Step 4: Size the disk and paste the script

In Configure storage, set the root volume size. Hatamoto adds a swap file by itself on small machines. Open Advanced details, find User data and paste this script:

#!/bin/sh
sh -c 'curl -fsSL -o /tmp/hatamoto-install.sh https://hatamoto.dev/install.sh && chmod +x /tmp/hatamoto-install.sh && env HATAMOTO_DOMAIN=cms.example.com HATAMOTO_ADMIN_EMAIL=you@example.com /tmp/hatamoto-install.sh'

Type your domain after HATAMOTO_DOMAIN= and your email after HATAMOTO_ADMIN_EMAIL=. For a trial on the free sslip.io name, delete the env part. EC2 runs user data as root, so there is no sudo, and anyone who can see the instance in the console can read it, so leave a secret setup code out. Leave User data has already been base64 encoded unticked, check the Summary panel and choose Launch instance.

Step 5: Attach an Elastic IP straight away

AWS gives an instance a public address from its pool and releases it when you stop the instance, so a start brings a new one and breaks your DNS record. An Elastic IP belongs to your account until you release it. In the EC2 console, allocate an Elastic IP address and associate it with the instance. It costs the same $0.005 an hour as the auto-assigned address, so attaching it adds nothing.

The installer reads the instance's public address once, during the install, and builds the sslip.io name and setup link from it. A domain waits for DNS to match that address. An install that ran before the association read the auto-assigned address, which your A record will not carry. Step 9 shows how to compare.

A short trial with no domain can skip this, as long as you do not stop the instance.

Step 6: Open ports 80 and 443

The wizard's security group allows SSH only. Open the instance, then its security group, and add inbound rules for TCP 80 and TCP 443 from anywhere (0.0.0.0/0, and ::/0 for IPv6). Button labels differ a little by console version, but the fields are type, port and source.

Step 7: Point your domain at the Elastic IP

At your DNS host, add an A record for the domain from your script, with the Elastic IP as its value. If the install read the Elastic IP, Hatamoto switches to your domain within minutes of the record working. No domain? Go on to step 8.

Step 8: Connect over SSH and watch the install

Run ssh -i my-key.pem ubuntu@ followed by the Elastic IP. EC2 Instance Connect in the console is another route if its prerequisites are met. Follow the install with:

sudo tail -f /var/log/cloud-init-output.log

You may see a warning that api.ipify.org gave an address that is not bound on this machine. That is normal on EC2, where the public address sits in front of the instance, and the installer uses the answer anyway.

Step 9: Compare the install's address with the Elastic IP

Find the setup link in the login message or the log. Its host is the address the install read, written with dashes: 203-0-113-7.sslip.io means 203.0.113.7. If it matches your Elastic IP, nothing more is needed.

If it differs, the install read the auto-assigned address, and your A record can never match it. Download the installer again and run set-domain with the Elastic IP given explicitly, using your own address and domain:

curl -fsSLO https://hatamoto.dev/install.sh
chmod +x install.sh
sudo env HATAMOTO_PUBLIC_IP=203.0.113.7 ./install.sh set-domain cms.example.com --email you@example.com

When DNS agrees, the installer switches the site, restarts it and prints a new admin link. Until then the current name keeps answering and the switch happens by itself later. With no domain, write the Elastic IP as an sslip.io name:

sudo env HATAMOTO_PUBLIC_IP=203.0.113.7 ./install.sh set-domain 203-0-113-7.sslip.io

This route has not been run on a live EC2 instance for this page.

Step 10: Create your owner account and snapshot the volume

Open the admin link from the login message, or the one set-domain printed. The setup code is already filled in. Then read First run.

For a copy of the disk, snapshot the instance's root volume from the EC2 console. AWS recommends stopping the instance first for a root volume, and the Elastic IP survives the stop. Amazon Data Lifecycle Manager and AWS Backup can schedule snapshots.

Check it worked

In the SSH session, run:

curl -i http://127.0.0.1:8090/health

A healthy server answers HTTP/1.1 200 OK first. Open your domain next. A padlock and the starter home page are the proof.

If something goes wrong

  • If SSH times out, check that the security group has an inbound TCP 22 rule whose source includes your address.
  • If the site does not load on port 80 or 443, add inbound rules for TCP 80 and TCP 443 to the instance's security group. This is the most common reason a new EC2 site looks dead.
  • If the site went down after a stop and start, the address changed. Attach an Elastic IP, point the A record at it and run set-domain with HATAMOTO_PUBLIC_IP, as in step 9.
  • If nothing installed, read /var/log/cloud-init-output.log. User data must start with #! and an interpreter, and is limited to 16 KB before encoding.
  • If the bill is higher than the instance price, the public IPv4 address, the volume and snapshots are billed separately.

Use the command line instead

aws ec2 run-instances takes the script with --user-data. Save the script as hatamoto-user-data.sh. You need an existing key pair and a security group that allows ports 22, 80 and 443, because the command creates neither. The image id comes from Canonical's public SSM parameter for the current Ubuntu 24.04 image:

aws ec2 run-instances \
  --image-id resolve:ssm:/aws/service/canonical/ubuntu/server/24.04/stable/current/amd64/hvm/ebs-gp3/ami-id \
  --instance-type t3.micro \
  --key-name my-key \
  --security-group-ids sg-0123456789abcdef0 \
  --user-data file://hatamoto-user-data.sh

For arm64, use arm64 in the SSM path and t4g.small. Nobody has run this command for this page. Then allocate and associate an Elastic IP as in step 5.

FAQ

How much does Hatamoto cost to run on EC2?

A t3.micro is $0.0104 an hour, about $7.59 a month. Add the public IPv4 address at about $3.65 a month and the disk at $0.08 per GB a month. Hatamoto is free to install.

Why does the installer warn about NAT?

On EC2 the public address is not bound on the instance's own network interface. Hatamoto asks api.ipify.org for it and logs the warning while using the answer. Setting HATAMOTO_PUBLIC_IP is optional and removes the warning.

Do I need an Elastic IP?

For a domain, yes. The auto-assigned address is released when the instance stops, so DNS would point at nothing. For a short trial on the sslip.io name you can skip it.

Can I use arm64?

Yes. Choose an arm64 Ubuntu image and a t4g type, such as t4g.small at $0.0168 an hour.

Is there a browser console?

EC2 Instance Connect gives browser SSH when its prerequisites are met. The EC2 Serial Console needs a password-based OS user, which the default Ubuntu user is not.

Does the Free Tier cover this?

AWS says accounts created from 15 July 2025 get up to $200 in credits for six months, and t3.micro and t4g.small are on the eligible list. Check AWS for the current terms.

Can I use Debian on EC2?

Hatamoto supports Debian 12 and 13, but this page covers Ubuntu 24.04 only, because Debian images on EC2 were not confirmed when it was written.

Hatamoto installs the same way on DigitalOcean, Vultr, Amazon Lightsail, Hetzner Cloud and Linode. The full option list is in Install on a VPS.