How Does EC2 Per-Second Billing Work for Linux and Windows?
Amazon EC2 per-second billing charges users for the exact number of seconds their Linux and Windows instances remain in a running state, subject to a 60-second minimum charge per launch. This model applies to open-source Linux distributions such as Amazon Linux, Ubuntu, and Debian, as well as Windows Server instances across On-Demand, Reserved, and Spot purchasing models. By eliminating paying for unused minutes at the end of an hour, per-second billing lowers compute costs for variable, transient, and auto-scaling workloads. Commercial third-party operating systems with separate licensing agreements and hourly AWS Marketplace products may still default to hourly increments.
Core Mechanics of EC2 Per-Second Billing
When you launch an eligible Amazon EC2 instance, billing starts the
moment the instance transitions into the running state and
stops immediately when the instance enters the stopping or
shutting-down state. Instead of rounding usage up to the
nearest full hour, AWS calculates the billable duration down to a single
second.
Every time an instance is started or launched, AWS enforces a 60-second minimum charge. If an instance runs for 25 seconds and is then terminated, your account is billed for 60 seconds. Once usage exceeds 60 seconds, charges accumulate strictly on a per-second basis. If you stop an instance and start it again later, that subsequent start begins a new billing period subject to its own 60-second minimum.
Operating System Eligibility: Linux vs. Windows
While both Linux and Windows instances support per-second billing, licensing structures determine which distributions qualify.
Linux Instances
Per-second billing was initially introduced for open-source Linux distributions that do not carry external commercial licensing fees. The following Linux operating systems are billed per second:
- Amazon Linux and Amazon Linux 2 / 2023
- Ubuntu
- CentOS and Rocky Linux
- Debian
- Fedora
Commercial Linux distributions that bundle paid support or subscription licenses directly into the EC2 instance price follow different rules. Red Hat Enterprise Linux (RHEL) and SUSE Linux Enterprise Server (SLES) have historically relied on hourly billing unless launched through specific Bring Your Own Subscription (BYOS) programs or updated AWS licensing tiers that explicitly enable per-second tracking.
Windows Instances
AWS extended per-second billing to Windows Server instances (including Windows Server with SQL Server) across standard EC2 purchasing options. When running licensed Windows AMIs provided by AWS, the per-second rate incorporates both the underlying compute hardware and the Microsoft Windows Server license cost, prorated to the second after the 60-second minimum threshold.
Supported Purchasing Options
Per-second billing works across the primary EC2 purchasing models:
- On-Demand Instances: Billed directly per second based on the published hourly rate divided by 3,600.
- Spot Instances: Billed per second at the prevailing Spot market price, allowing interrupted or short-lived batch jobs to pay only for exact runtimes.
- Reserved Instances and Savings Plans: Per-second
usage is aggregated across an entire billing hour. If you hold one
Reserved Instance for a
c6i.largein a specific Availability Zone, you receive 3,600 seconds of discounted compute capacity inside that clock hour. You can consume those 3,600 seconds by running one instance for a full hour, four instances concurrently for 15 minutes, or sixty instances concurrently for 1 minute. - Dedicated Hosts and Dedicated Instances: The per-second model applies to qualified instances launched onto Dedicated infrastructure, though the underlying Dedicated Host reservation itself may follow separate hourly or commitment terms.
Cost Calculation Formula
Although usage is tracked in seconds, AWS price sheets list EC2 rates per hour and report line items on your monthly bill in decimal hours. To calculate the exact cost \(C\) of running an instance for \(t\) seconds at a published hourly rate \(R\), use the following formula:
\[C = \max(t, 60) \times \frac{R}{3600}\]
Similarly, the billable quantity in hours \(H\) displayed on your AWS Cost and Usage Report is calculated as:
\[H = \frac{\max(t, 60)}{3600}\]
Calculation Example
Suppose you run a Windows Server m6i.xlarge instance
with an On-Demand hourly rate of \(R =
\$0.376\) for 15 minutes and 30 seconds (\(t = 930\) seconds):
- Verify that \(t \ge 60\): Since \(930 > 60\), the actual runtime of 930 seconds is used.
- Convert seconds to decimal hours: \[H = \frac{930}{3600} \approx 0.258333 \text{ hours}\]
- Multiply by the hourly rate: \[C = 930 \times \frac{0.376}{3600} \approx \$0.09713\]
Under legacy hourly billing, this 15.5-minute task would have cost the full \(\$0.376\) for one hour. With per-second billing, the cost drops to \(\$0.097\), saving roughly \(74\%\).
Related Services and Exceptions
When budgeting for EC2 workloads, remember how attached resources and Marketplace software interact with per-second billing:
- Amazon EBS Volumes: Provisioned Elastic Block Store
(EBS) volumes (
gp3,gp2,io2) and snapshots are also billed in per-second increments (with a 60-second minimum). However, EBS storage charges continue to accrue while an EC2 instance is in thestoppedstate because the storage blocks remain allocated until the volume is deleted. - AWS Marketplace AMIs: Many third-party software appliances sold on the AWS Marketplace charge an hourly software fee on top of the base EC2 infrastructure cost. While the underlying EC2 instance might be billed per second, the third-party software vendor fee may still bill by the full hour unless the vendor supports per-second metering.
- Elastic IP Addresses: Unassociated Elastic IP addresses or additional IPs attached to instances are billed on an hourly basis rather than per second.
Workloads That Benefit Most
Per-second billing provides the greatest financial impact for elastic and ephemeral compute patterns:
- CI/CD Build Agents: Automated testing and compilation runners that spin up for 3 to 8 minutes per pull request and terminate immediately afterward.
- Auto Scaling Groups: Web tiers that scale out rapidly during brief traffic spikes and scale back in within minutes once demand subsides.
- Container Clusters (ECS and EKS): Worker nodes managed by Karpenter or Cluster Autoscaler that provision capacity for burst pods and deprovision nodes as soon as jobs finish.
- Batch Processing and Analytics: Amazon EMR clusters, data transcoding pipelines, and machine learning training jobs that scale horizontally across hundreds of nodes to finish a multi-hour job in a few minutes.