I have an AWS EC2 t2 micro. CPU Credit Usage shows that I am using 1.1 credit every hour (use the summation stats). But Credit Balance shows a 0.5 credit decrease per hour.
My understanding is that micro instance will earn 3 credits per hour. So the balance should only decrease if the credit usage is more than 3 per hour.
However I am only using 1.1 credit per hour. Why does the balance decrease?
AWS has answer for this:
For example, if a t2.small instance had a CPU utilization of 5% for the hour, it would have used 3 CPU credits (5% of 60 minutes), but it would have earned 12 CPU credits during the hour, so the difference of 9 CPU credits would be added to the CPU credit balance. Any CPU credits in the balance that reached their 24 hour expiration date during that time (which could be as many as 12 credits if the instance was completely idle 24 hours ago) would also be removed from the balance. If the amount of credits expired is greater than those earned, the credit balance will go down; conversely, if the amount of credits expired is fewer than those earned, the credit balance will go up.
See link: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/t2-instances.html
Related
I have a question regarding Heroku billing. So, every account gets 1,000 free dyno hours per month (if we add credit card info). That is technically enough for 1 app but if there are more than one and they are awake all the time, then I will exceed the 1,000 hours per month. Do you know how I will be charged for extra hours? After 1,000 hours are reached?
2nd question. The other dyno plans (hobby, standard, etc.) charge monthly for like $7, $25, etc. I know these paid accounts never let your app sleep and there is more RAM, free SSL, etc., but the usage pricing still works similar to free plan (with 1,000 free dyno hours and then charged for extra hours). or with these plans I won't be charged more than $7, $25, etc. for dyno hour usages?
You won't be charged after 1000 hours is reached. Your Dyno app will just shut down and not run.
They don't use free dyno hours. If you are running the app continuously for a month it will be $7, $25 etc. If it is just a day it will charge 1/30 of $7, $25 etc. They are billing hourly use but they won't exceed the monthly advertised price.
Recently I was required to reboot my EC2 instance due to an AWS maintenance alert. After reboot I noticed my CPU credit balance was consumed. Why is that? What's going on?
Stopping and Starting a t2-standard class instance moves your instance to a new host system, clears your credit balance and then ordinarily¹ gives you a baseline of 30 credits per vCPU to ensure a smooth start-up.
T2 Standard instances get 30 launch credits per vCPU at launch or start. For example, a t2.micro has one vCPU and gets 30 launch credits, while a t2.xlarge has four vCPUs and gets 120 launch credits.
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/t2-std.html
Rebooting doesn't do this, but restarting (that is, a stop followed by a start) does, and the stop/start required for most maintenance events is a restart, not a reboot.
Tip
To ensure that your workloads always get the performance they need, switch to T2 Unlimited or consider using a larger T2 instance size.
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/t2-std.html
T2 unlimited machines are allowed to borrow against future CPU credit earnings for the upcoming 24 hours, so they don't receive the initial credit balance. You aren't charged extra for these borrowed credits, unless your workload is so heavy that over the subsequent 24 hour period is you continue to use credits at a rate that causes you to spend more than you could have earned.
¹ordinarily unless you have performed more than 100 stop/starts or launches of more than 100 t2-standard machines in the past 24 hours or your account is new, to prevent gaming the system. New accounts gradually ramp up to the 100 threshold.
I'd like to buy a "Hobby" package on Heroku but I'm confused by the pricing. It says $7 per Dyno per month, but then it also says you pay for the fraction of actual processing time. So if I have a thousand 100ms requests a day thats just 50 minutes a month. So do I pay 7/(30*24*60)*50 dollars for that total?
What if I dont have a single request for a month at all? Do I still need to pay?
thank you
Edit: I meant minutes, even less then
If your dyno runs 24*7 the whole month you have to pay 7$.
If your dyno runs just one day in a month you pay 7/30 $.
This is what "fraction of actual processing time" means.
So the Hobby Dyno won't cost more then 7$.
Ec2 instance hour calculated by hour by hour. If you just start and close an instance, it still counted as one hour.
How Heroku handle this? By Minute or By Hour?
Lets assume my app usage exceeds 750 Free Dyno Hour Limit
Heroku prorata to the second. A dyno costs $0.05 per hour. So if you go over 750 hours you will be charged at $0.05 per hour or $0.000833333 per minute. In fact, pretty much all addons also follow the same billing model too.
You can read about billing and charges as https://devcenter.heroku.com/articles/usage-and-billing#cost
I will say, though, that the previous answer seems to be more accurate for the web dyno versus a worker dyno. Heroku's automated sleep cycle for your web dyno tries to prevent it from running too long when it's idle, say, for more than an hour. For the free web dyno it must sleep at least six hours per day for it not to incur charges. As long as you set the scaling to 1 for your web dyno and it sleeps then it should be free.
That said, when you add your first worker dyno those same automations aren't applied to this dyno. It presumably won't be triggered to sleep on idling for an hour. This means that unless you manage it you'll likely be charged $34.50 for each worker dyno per month. I wouldn't exactly call this lying to the customer but most people start off with that first free dyno, get comfortable with that and then innocently think that the next dyno will behave in a similar way--it won't and you'll likely get tagged paying more money than you'd bargained for. That's $414-per-year for a dyno. Compare this with Amazon's t2.micro cost of $150-per-year for one instance or $75-per-year for a 50% duty cycle of same.
As they say, "the devil is in the details". Heroku might be cheap for vanity websites but it's a bit costly if you have a database and worker thread (without any scaling otherwise whatsoever).
Based upon this: Reserved Instances can be purchased for 1 or 3 year terms, and the one-time fee per instance is non-refundable. Light and Medium Utilization Reserved Instances also are billed by the instance-hour for the time that instances are in a running state; if you do not run the instance in an hour, there is zero usage charge. Partial instance-hours consumed are billed as full hours. Heavy Utilization Reserved Instances are billed for every hour during the entire Reserved Instance term (which means you’re charged the hourly fee regardless of whether any usage has occurred during an hour).
Why would I ever buy the heavy utilization package when I could use the light package and save money whenever the server is'nt being used??
Apologies for my previous comment, which does seem argumentative now I read it again. Hopefully this answer will make up for it.
With the 3 different packages for reserved instances, Amazon is giving you a tradeoff between what you pay up front for the reserved instance and how much you pay per instance hour for running instances. The up front cost is lowest for Light Utilization instances and lowest for Heavy Utilization instances, but it's the other way around for the hourly cost; that is lowest for Heavy Utilization and highest for Light Utilization.
Let's do some math to illustrate, using a Small Linux instance with a one year reservation term. Here are the relative prices:
Up front payment: $69 for Light, $195 for Heavy
Hourly cost: $0.039c for Light, $0.016c for Heavy
Let's say you run your instances for only 1 hour per day, or 365 hours during the 1 year reservation period. Your total cost would be:
Light: $69.00 + (365 * $0.039) = $83.24
Heavy: $195.00 + (365 * $0.016) = $200.84
But when we run the instances for 20 hours a day or 7300 hours overall, we get:
Light: $69.00 + (7300 * $0.039) = $353.70
Heavy: $195.00 + (7300 * $0.016) = $311.80
So if you predict your workload carefully, you can make some significant savings by choosing the right pricing scheme.
#gareth_bowles answer has one error -- Heavy Utilization instances are charged for every hour, regardless of whether the machine is on or not.
The cost for different Utilization rates looks like:
Heavy: $195 + (365 * 24 * $0.016) = $335.16 (independent of hours used)
Medium: $160 + (365 * N * $0.024) = $160 + 8.76N (use N hours / day)
Light: $69 + (365 * N * $0.039) = $69 + 14.235N (use N hours / day)
On-Demand: $0 + (365 * N * $0.080) = $29.2N (use N hours / day)
The break-even usage points are:
Heavy: > 80% utilization (20 hrs / day)
Medium: < 80% utilization (20 hrs / day)
Light: < 70% utilization (16.6 hrs / day)
On-Demand: < 20% utilization ( 4.6 hrs / day)