Thursday, October 27, 2022

[SOLVED] What does it cost to start and immediately terminate an Amazon EC2 instance?

Issue

For example the list price for a nano instance is $0.0065 per Hour.

If I start and immediately terminate a nano instance, did it cost me $0.0065?

The reason this question relates to programming is because I am programmatically launching instances and I want to know if it's going to cost alot or be a trivial expense if my code does live launching as I'm testing.


Solution

For "on demand" EC2

Pricing is per instance-hour consumed for each instance, from the time an instance is launched until it is terminated or stopped. Each partial instance-hour consumed will be billed as a full hour.

See https://aws.amazon.com/ec2/pricing/

This used to be the case...but now (as of Oct 2021)

Each partial instance-hour consumed is billed per-second for instances launched in Linux, Windows, or Windows with SQL Enterprise, SQL Standard, or SQL Web instances If your instance is billed by the second, then you're billed for a minimum of 60 seconds each time a new instance is started—that is, when the instance enters the running state

Some instances do still have a minimum charge period of one hour, but in the case of the OP's question the answwer is now 1 minute minimum

See https://aws.amazon.com/premiumsupport/knowledge-center/ec2-instance-hour-billing/



Answered By - Vorsprung
Answer Checked By - Cary Denson (WPSolving Admin)