Costs on EC2 Free Tier

0

Hi, I am seeing some costs coming through in my EC2 free tier and I wanted to know if there is something that I can do to avoid it. All costs are coming through under "0.05 per vCPU-Hour of T3 CPU Credits". This cost is coming through every hour. I am running a very basic webscraper which does some very simple calculations which should not be cpu intensive at all. I know someone whos says they ran a very similar programme on their T2 instance under the free tier a year back and never got any costs. Currently my predicted cost is around $38 for the month. I do need the programme to run continuosly because I need to be notified the second something happens. The documentation does mention something about running in standard mode (https://aws.amazon.com/ec2/instance-types/t3/) but I can find no such option anywhere.

Goten
asked 5 months ago311 views
2 Answers
1
Accepted Answer

A good explainer for what's happening is at https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-credits-baseline-concepts.html

In Unlimited mode, if the instance bursts above baseline CPU utilization, then the instance first uses the accrued credits to burst. If there are no accrued credits remaining, then the instance spends surplus credits to burst. When its CPU utilization falls below the baseline, it uses the CPU credits that it earns to pay down the surplus credits that it spent earlier. The ability to earn CPU credits to pay down surplus credits enables Amazon EC2 to average the CPU utilization of an instance over a 24-hour period. If the average CPU usage over a 24-hour period exceeds the baseline, the instance is billed for the additional usage at a flat additional rate per vCPU-hour.

The bit in bold is highlighted by me, and this is what is happening to you.

There's a worked example here https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/unlimited-mode-examples.html#t3_unlimited_example

Take a look at the CPU usage stats in the Monitoring tab of the EC2 section of AWS Console, what's the CPU usage looking like in there? You mention that your workload isn't CPU intensive, but bear in mind that the t3.micro (the only T3 instance type that's in-scope of free tier, so it has to be this that you're running) has only 1GB of memory and two cores, and that everything else (not just your webscraper) has to run inside that.

Usually that is close to negligible, but suppose your workload is consuming a lot of memory - as free memory becomes scarce (and there's only 1GB of it to start with) eventually the kernel swapper will come into play and start to consume more and more CPU as it looks for scraps of memory that it can free up. Not saying this is happening in your case, but these are the kind of things that may not be immediately apparent, but will still contribute to CPU utilisation.

Anyway, this is getting away from the main point about why this item is appearing on your bill. If you still feel you have been wrongly charged then raise a billing support case with AWS https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/billing-get-answers.html#billing-support

profile picture
EXPERT
Steve_M
answered 5 months ago
  • Thanks. I have made some tweaks to the programme that have reduced the cpu usage significantly and the costs have come down in the last couple days.

-1

There are three ways we recommend tracking your free usage to avoid unexpectedly transitioning to pay-as-you-go pricing: [1] View on the Free Tier page in AWS Billing & Cost Management console (See Question 3). [2] Use the GetFreeTierUsage API (See Question 4). [3] Read your AWS Free Tier usage alert emails (See Question 5).

profile pictureAWS
SUPPORT ENGINEER
Ravid_G
answered 5 months ago
  • Hi, I'm not sure how this quite covers my question. I mainly want to know why my basic program is adding to the "0.05 per vCPU-Hour of T3 CPU Credits" and how to avoid this.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions