This guide walks through launching a small Ubuntu server on Amazon EC2 that is ready for a WordPress stack. It focuses on the choices that are hard to change later.
Which EC2 instance type suits a small WordPress site? #
A 2 vCPU, 4 GB RAM instance such as a t4g.medium handles most small to mid-size WordPress sites with a page cache and Redis. Graviton (arm64) instances usually cost less for the same performance, as long as your software has arm64 builds.
Step 1: Create the security group #
- SSH (22): your own IP address only, never 0.0.0.0/0.
- HTTP (80) and HTTPS (443): open to the internet.
- Leave all other inbound ports closed.
Step 2: Launch the instance #
aws ec2 run-instances --image-id ami-xxxxxxxxxxxxxxxxx --instance-type t4g.medium --key-name my-key --security-group-ids sg-xxxxxxxx --block-device-mappings 'DeviceName=/dev/sda1,Ebs={VolumeSize=40,VolumeType=gp3}'
Step 3: Attach an Elastic IP #
Allocate an Elastic IP and associate it with the instance so your public address survives stops and restarts. Point your DNS A record at that address.
Step 4: Connect #
ssh -i ~/.ssh/my-key.pem ubuntu@YOUR_ELASTIC_IP