Alright, let’s talk about the credit card of the cloud: On-Demand Instances. This is the default, the baseline, the “shut up and take my money” option. You click a button, a virtual machine spins up, and AWS starts billing you by the second (for Linux) or by the hour (for Windows) until you tell it to stop. It’s the most straightforward way to get compute power, and it’s also the most expensive in the long run. Think of it like a hotel room at the airport: incredibly convenient, available right now, but you wouldn’t want to live there for a year.

The primary reason you use On-Demand is for its beautiful, blissful lack of commitment. Your application’s traffic just exploded because of a viral tweet? Spin up a dozen c6g.2xlarge instances on-demand to handle the load, then terminate them an hour later when the frenzy dies down. You’d be a fool to try and handle that kind of spiky, unpredictable workload with a reserved instance. This flexibility is the entire point. You’re paying a premium to never have to think ahead.

The Billing Reality: By the Second, But Not Really

AWS loves to tout “per-second billing,” which is technically true for Linux and Unix-like systems. But don’t get too excited. You’re still on the hook for a minimum of 60 seconds. So if you start an instance, freak out, and terminate it after 45 seconds, you’re paying for a full minute. If you let it run for 61 seconds, you’re paying for 61 seconds. It’s granular, but it’s not magic. For Windows instances, it’s still the less-granular per-hour model, because of… reasons. Probably something to do with Microsoft licensing, which is a special circle of hell we’ll visit another time.

Here’s the kicker, and a classic AWS “gotcha”: storage is billed separately. That m5.large instance might cost $0.096 per hour, but that doesn’t include the EBS volume you attached to it. If you forget to delete the volume after terminating the instance, that lonely disk will just sit there, quietly nickel-and-diming you for months. I’ve seen more bills bloated by orphaned EBS volumes than by actual compute time.

How to Actually Launch One (The Right Way)

You could use the AWS Console, clicking through a maze of options and inevitably missing a setting. Or, you could be an adult and use the CLI or infrastructure-as-code. Here’s how you’d launch an On-Demand instance with the AWS CLI. Notice I’m specifying everything explicitly; this is to avoid any default settings that might come back to haunt you.

# Launch a t3.micro instance (Linux 2 AMI) with a tagged EBS volume
aws ec2 run-instances \
    --image-id ami-0c02fb55956c7d316 \  # This is an Amazon Linux 2 AMI in us-east-1; always use the latest!
    --instance-type t3.micro \
    --key-name my-key-pair \  # You created this already, right?
    --subnet-id subnet-12345abcde \  # Put it in a public subnet if you need SSH access
    --security-group-ids sg-12345abcde \  # This SG must allow SSH (port 22) from your IP
    --tag-specifications 'ResourceType=instance,Tags=[{Key=Name,Value=MyOnDemandInstance}]' 'ResourceType=volume,Tags=[{Key=Name,Value=MyOnDemandVolume}]' \
    --block-device-mappings '[{"DeviceName":"/dev/xvda","Ebs":{"VolumeSize":20,"VolumeType":"gp3"}}]'

This command does a few smart things: it tags both the instance and the EBS volume for easy identification, and it explicitly sets the volume type to gp3 (the modern, cost-effective default) and size to 20 GiB, preventing a legacy gp2 volume from being created.

When (and When Not) to Use On-Demand

Use On-Demand for:

  • Short-term, spiky, or unpredictable workloads.
  • Testing and development environments that you regularly spin up and down.
  • Emergency capacity when your reserved instances are maxed out.
  • Your very first foray into AWS before you have any idea what your usage will be.

Do NOT use On-Demand for:

  • Anything that runs 24/7/365. This is financial masochism. After a few months, you could have bought a Reserved Instance and saved 40-70%. It’s like paying full price for a streaming service when there’s a perfectly good annual subscription available.
  • Applications with stable, known baseline usage. That’s what Reserved Instances and Savings Plans are for, and we’ll get to those next. Using On-Demand for this is the number one rookie mistake that funds Jeff Bezos’s next trip to the moon.

The bottom line? On-Demand instances are your get-out-of-jail-free card for flexibility. They are indispensable for what they do. But use them wisely, because that convenience has a tax attached—a tax that compounds faster than you think. Always, always have a termination plan. Your wallet depends on it.