How to avoid unexpected charges when using AWS free tier

Hi, I’m really new to AWS. I’m a bit scared reading through posts about people getting unexpected charges. Besides setting up a billing alert, I want to get to know how the billing system works before starting my free tier instances.

I want to spin up a T3.Micro. To my understanding, there are limits on storage, network, and computation on EC2 instances. Where can I find these limits? If I exceed these limits, how much am I charged?

I also want to try the DynamoDB. The free tier includes 25G storage, 25 WCU and 25 RCU. The description says it’s enough to handle 200M requests per month. Does it mean I can write and read 200M times without being charged?

Also, are services like S3 and Lambda less likely to generate a big amount of charges even when I exceed the limit since their pricing seems pretty cheap? Are there things to watch out for S3 and Lambda too?

Is there any general advice to avoid unexpected charges?

Thank you :slight_smile:

Setup a CloudWatch billing alarm. Lots of tutorials out there.

This is the answer you need. Cloud watch will alert if you pass a threshold for your monthly bill. I set mine at $10 for basic testing and getting to know aws more but you can set it lower

its also really good to get into the practice of building and tearing down architectures. Unless its a production system and it has to stay up, stand it up, then tear it down.

Say you want to experiment with an EC2 instance. well, you can run commands at launch: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html

You could:

  1. run the code to build
  2. run the code to test your work
  3. store your results in an s3 bucket
  4. then tear down the instance

it may seem like a tedious approach to automate your experiments, but I promise that you will learn more, build faster, iterate faster, and be charged less.

Besides billing alerts, take 10 minutes and learn proper management of your credentials. Delete API keys from your root account and lock it down with MFA. Use an IAM account for your day-to-day access, and NEVER commit those credentials anywhere.

Good advice and I’ll add that infrastructure as code (IaC) is really helpful with this. You can look into specific tools/frameworks like CloudFormation, Terraform, Ansible, etc. It lets you spin up and destroy infrastructure with a simple command and save the resource configuration in version control.

Hi,

Everyone here is telling you to use billing alarms and budgets and that is correct. However, there are other things you can do to help.

Learn to use cloudformation early and use it for everything you create. That way you can tear down a stack and it will get all the resources instead of you having to remember what all you created.

The first thing you need to understand about the free tier is that some services have free tier limits that last forever and others only have them for the first 12 months of your account. You can find that data here: https://aws.amazon.com/free/?all-free-tier.sort-by=item.additionalFields.SortRank&all-free-tier.sort-order=asc&awsf.Free%20Tier%20Types=*all

Another trick you can use (and someone feel free to correct me if you think i’m wrong) is to use make sure you provision one read unit and one write unit in dynamo The average cost of this should be about $0.56 + some minor charges for data transfer. The on-demand is $1.25/million.
Unless you are using lambda in production servicing a decent traffic base, you’ll not run over the lambda free tier in a testing environment.

With all that said, there is one thing you need to be especially careful with because this is something that bites me still to this day and that’s ebs volumes. One recommendation I have is to create 2 volumes on creation. One that’s a minimal size for your OS and installed programs. The other that’s sized for the data you have on it. This way you can expand the data volume easily later on without having to worry about taking down your instance.

One more thing is Elastic IPs. You are not charged for them as long as they are associated with a running instance.

Hope this helps.

As a lot of others are mentioning, please secure your root account. Create an IAM user with the appropriate policy (likely AdministratorAccess). You can find your free tier limits under User (top right corner) → My Billing Dashboard → Bottom of Screen will have Free Tier usage %.

Furthermore, it might be a little more simple than a CloudWatch billing alarm, but you can go to My Billing Dashboard → Cost Management → Budgets to configure alerts and alarms for your budget preferences (I think I have mine set to $25 a month and get an email after $20 is consumed).

As others have mentioned, turn off services when you are not using them (i.e. EC2). Limit public access to S3 unless you need it for some reason (remember, you also pay for PUT, GET, LIST, etc.) If you enable S3 Server Access Logs, DO NOT STORE THE LOGS ON THE SAME BUCKET. This creates an infinite loop of logs and can accrue a large cost.

Unfortunately I don’t have an solid answer for your DynamoDB question.

CloudWatch billing alarms!

Set up everything using CF and no other way. This way one look in the CF console shows you what you have and you can destroy it all from there.

Be cautious with NAT gateways, they are great but do cost. Using private networks is great but if you need external integration put your resource in a public network with strict SGs and if you need AWS service integrations use vpc endpoints in your private subnets.

Thats what I am getting into now after a whole bunch of more manual development to get a feel for the general tool set. Its a lot harder (IMO, but I am very knew to this part)

if anyone has any good recommendations on where to get started with IAC or tutorials/courses/videos they, I’d love to hear it.

Here’s how not incur charges in free tier :

  1. Seems to have been mentioned already but still reiterating : most important rule - DO NOT keep anything active/online/lying around once you’ve done practicing. ANYTHING. Even if you’re still well within free tier limit of that service.

Deactivate and/or delete the service. Rds, ec2, s3, lambda functions you name it. Delete once you’ve done learning a part. Build everything from scratch if you want to have another go (e.g. deploying a fault tolerant, multi AZ LB enabled LAMP stack )

1a. Your .pem/.ppk file in a region is an exception. Do not have to necessarily create a new key pair every time. Use the one you’ve saved locally.

  1. Custom vpcs cost. Every time traffic flows through your NAT gw, it may incurr cost.

  2. As a consequence of #2 be wary of elastic ips. Uploads & downloads through them may shoot you out of your free tier range.

  3. You are provided with 1 free elastic ip per account. A total of 5 is allowed to a free tier account Say you’re using the AWS provided one in your custom vpc. If you’ve spun a new one and it’s just lying dormant i.e NOT attached to an instance or gateway, you’re going to be charged by the hour.

Same goes for unused network interfaces lying around.

  1. As much possible, stick to the default VPC. If you’ve built a custom one, break everything down after practicing.

  2. Global accelerators will incur cost right at the outset.

  3. AWS direct connect is not feasible if you’re using for solo learning purpose since it involves a third party network service provider to set up a direct line from on premise to aws centre. You’ll not be able to provision one directly on your own anyways but if you’ve tinkered with the UI for learning, make sure not to hit save/delete everything.

  4. For route 53, you’ll be charged for a domain name if you’re using a new AWS provided one (.com .net, .org, all)
    Utilize a self-owned domain name or get a temporary free domain. There are many websites available which provide one.

  5. Regardless of whether you’ve set up a cloudwatch billing alarm make a habit of checking your billing dashboard as the first thing to do once you login to the console as a root user.

Also, make sure to periodically check for mails from Aws in the email account you’ve used to sign up.

That’s all I can think of now. Will keep adding.

A lot of people are giving you the complex, scary sounding intermediate to advanced answers. (Cloudwatch, cloudformation, automation). Those are great tools and things you should learn as you stay in AWS. But it is a little like presuming you need to eat the whole elephant instead of a bite at a time.

The simple advice I’d give is to Be Paranoid but don’t let it stop you.

  1. Understand that AWS accounts are targets for hacking. Amazon is really good about helping out when a new user gets compromised and runs up a big bill, but it is a hassle and can be very stressful if it happens. Root account security and MFA are your best shields at this stage. Learn that early. https://aws.amazon.com/blogs/security/getting-started-follow-security-best-practices-as-you-configure-your-aws-resources/ (don’t worry too much about the group email thing unless it makes sense in your environment.)
  2. Find the billing dashboard. Watch it obsessively.
  3. HTTP://aws.amazon.com//pricing will walk you through the things that cost money. read and try to understand before doing new things.
  4. Try a thing. Let it run for a while within your understanding of the pricing.
    Try to stop a thing. Check the billing console. Understand that data in the console might not show up for a few hours. Also understand that free tier zero cost activity doesn’t always show on the bill until it actually costs money. (that used to be universally true. I’m not 100% sure now)
  5. Try more things. Rinse, wash and repeat.

It is very possible to learn a lot without spending alarming amounts of money.
Don’t be afraid to learn. Be paranoid. Learn from the experience. As you get more comfortable, make it a priority to layer in cloudwatch alarms and deployment automation techniques.

(Your question comparing EC2, S3 and lambda costs to one another is very much about what you want to do. Their costs are based on entirely different things. EC2 is about how long the system/storage are running. S3 is about volume stored and lifecycle management. Lambda is about runtime at a different granularity than EC2. Which would end up being cheaper depends on what you want to accomplish and your reasons for the approach you pick.)

To add to this comment, here is an example template that you can use to deploy the alarm to your account: https://asecure.cloud/a/cwalarm_billing/

^ This. I have a $1.00 alarm on my personal account

AWS Budgets.

Also, I recommend the AWS-SAA Certification. It teaches you a lot of entry level stuff. AWS is different from normal IT. It’s OK to take a course to learn about stuff.

I am working towards this at the moment with this video course.

It’s only $15 - $25 for the whole thing currently. Compared to my RHCSA, this is a steal.

I can’t say I regret the purchase and the instructor runs you through stopping instances, removing elastic IPs, ELBs, etc, so you don’t get charged excessively.

Ah. there’s a sub named /r/AWSCertifications

They recommend Stephane Maark’s course on UDemy. It was good. I also took DolphinEd’s.

Just don’t trust it too much. AWS cost/bills are only updating every 4-5-6 hours, so you will be always a bit behind. It is really annoying.

You have to be using some really meaty stuff (or be hacked) to run up costs of much significance in 6 hours. No basic tutorial should have you creating anything near that charge level, but ultimately if your goal is to learn to use an enterprise level data centre virtualization tool you do need to approach that with a level of care around what commands from tutorials you just run in your account.

Aws-vault from 99designs makes this super easy, especially if you’ve got access to multiple AWS accounts with their own unique MFA and roles.