What it is
Amazon EC2, Elastic Compute Cloud, provides virtual servers in the AWS cloud. You choose an instance type for CPU and memory, a disk on EBS, an operating system such as Ubuntu, and a security group that decides which ports are open. It is the closest AWS gets to a server you run yourself, with full control and full responsibility.
Instances can be resized, snapshotted and replaced. EBS snapshots back up the disks, Data Lifecycle Manager schedules them, and Graviton instances run on AWS's own Arm processors for a lower price. Unlike serverless services, an instance runs and bills around the clock, so it suits steady workloads that need to be up all day.
How I use it
- One Ubuntu instance behind Apache runs the Rental Pilot API in PHP, its MySQL databases, the Node real-time chat server and cron jobs for billing checks and reminders.
- Production and the sandbox share the box but never a database. The sandbox is refreshed from a production snapshot with customer emails scrubbed.
- Lend Pilot runs on its own instance in its own AWS account and region: the Node API, PostgreSQL and the web app in Docker Compose behind nginx.
- The stucco company's job app and two WordPress sites share the Rental Pilot server under separate Apache sites.
- EBS snapshots run on a schedule from Data Lifecycle Manager, and CloudWatch watches memory and swap.
EC2 is the right tool for a long-running API with a database beside it, a WebSocket server, or software that expects a normal Linux machine. Rental Pilot and Lend Pilot are exactly that. I administer the servers myself, so patching, backups and security are part of the job, not someone else's ticket.
Questions
Do you manage the servers yourself?
Yes. I administer the EC2 servers for Rental Pilot, Lend Pilot and the stucco company, including patching, backups, monitoring and deploys.
Why run a server instead of going serverless?
Rental Pilot is a steady API with MySQL and a real-time chat server beside it, which suits a server. This website is bursty, so it runs on Lambda instead.