- Newest
- Most votes
- Most comments
I apologize, but there seems to be a misunderstanding in your observation. EC2 Spot Instances, like On-Demand instances, are indeed billed per second with a minimum of 60 seconds. They are not billed for a full hour if they run for less time.
Based on the information you've provided, it appears that you're looking at the total cost for the instance, not the actual billed duration. The $0.16 charge you're seeing for a 6-minute run of an r4.xlarge Spot Instance is actually consistent with per-second billing, not hourly billing.
Let's break it down:
- The On-Demand price for an r4.xlarge instance is $0.3201 per hour.
- Spot Instances typically offer significant discounts, often up to 90% off the On-Demand price.
- If we assume a 50% discount (which is conservative), the Spot price would be around $0.16 per hour.
- For a 6-minute run, that would be approximately (6/60) * $0.16 = $0.016
The $0.16 you're seeing is likely the maximum possible hourly rate for that Spot Instance, not what you were actually charged for the 6-minute run.
To verify this, I recommend checking your detailed billing report or Cost Explorer, which will show the actual runtime and charges for each instance. You should see that you're only being charged for the actual runtime, not for a full hour.
If you're still concerned, you might want to:
- Double-check your AWS Batch configuration to ensure it's set up to use Spot Instances correctly.
- Verify in your billing details that you're actually being charged for full hours and not just seeing the potential maximum hourly rate.
- Contact AWS Support if you find any discrepancies in your actual billing.
Remember, AWS Batch is designed to work well with Spot Instances, and when configured correctly, it should take advantage of the per-second billing to optimize your costs.
Sources
Billing on Ec2 instance for a particular time | AWS re:Post
Billing for interrupted Spot Instances - Amazon Elastic Compute Cloud
Yes, spot instances are not charged hourly, it's billed by seconds after the first 60 seconds. Spot savings summary may not show the actual data. It is better if you can confirm the actual charges from Cost Explorer. If the EC2 is tagged or if you have only a few EC2s, you can easily identify the actual cost incurred by this EC2 in the Cost Explorer.
Relevant content
asked 4 years ago
asked 4 years ago
- AWS OFFICIALUpdated a year ago
