# AWS estimated charges - get notified in a few steps!

Whenever we deploy resources on AWS, we need to keep in mind that costs are something to monitor closely.

![](https://media.giphy.com/media/3oKIPm3BynUpUysTHW/giphy-downsized-large.gif align="center")

AWS offers a Free Tier, with the most used services for you to start exploring. And some of them are always free (within a given quota)!

> If you are curious, here is the [free tier offering vs quotas vs services](https://aws.amazon.com/free/?all-free-tier.sort-by=item.additionalFields.SortRank&all-free-tier.sort-order=asc&awsf.Free%20Tier%20Types=*all&awsf.Free%20Tier%20Categories=*all).

AWS also offers a quick way of monitoring your usage and costs, which consists in [enabling an alert whenever your forecasted costs reach a certain threshold](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/monitor_estimated_charges_with_cloudwatch.html) using CloudWatch alarms and AWS SNS service (to send email notifications).

To add this feature, you will need to have access to your [AWS Billing console](https://console.aws.amazon.com/billing/) and logged as a user with proper permissions or use the root account (not recommended).

## Enabling notifications

In **Billing Preferences** &gt; under **Cost Management Preferences** tick the box **Receive Billing Alerts** and save preferences. Also, tick **Receive Free Tier Usage Alerts** if you want to be notified about Free Tier usage.

## Creating an alarm

> Before starting, change your current region to **us-east-1 (N. Virginia)**. This is where the Billing information is stored and represents worldwide charges.

In [CloudWatch console](https://console.aws.amazon.com/cloudwatch/), go to **Alarms** in the left pane and choose **All Alarms**.

* **Create alarm** (top right).
    
* Then **Select metric**.
    
* In **Browse**, select **Billing** and then **Total Estimated Charge**.
    
* Select the **EstimatedCharges** metric row and then **Select metric**.
    
* For **Statistics**, select **Maximum**.
    
* For **Period**, select 6 hours.
    
* Next, for **Threshold type**, choose **Static.**
    
* For **Whenever EstimatedCharges is...**, choose **Greater**.
    
* For **than...** enter a threshold that will trigger this alarm. For this example, I used 2 USD as the value threshold.
    
    * For reference, I have mine set to 5 USD and it is more than enough to play around with my implementations.
        
* In **Additional configuration**, leave **Datapoints to alarm** default 1 out of 1 and **Treat missing data as missing.**
    
* Next.
    
* In **Notification** section:
    
    * under **Alarm** state trigger, select **In Alarm**.
        
    * **Send a notification to the following SNS topic**, you can select an existing topic or create a new one (or use a topic ARN in a different account).
        
        * (In my case, I created a new topic).
            
        * Give it a descriptive name.
            
        * Add an email account to send emails to.
            
        * **Create topic**.
            
            * You will get an email asking to confirm the subscription. If you don't receive it in 5 minutes, check your Spam folder (mine got filtered by Gmail).
                
                ![](https://cdn.hashnode.com/res/hashnode/image/upload/v1678198021145/6565f91a-b6bc-43d8-ab89-b50baebf1b5a.png align="center")
                
            * If for some reason you cannot confirm it via email, you can do it manually in the SNS console using the link generated after you click on **Create topic**.
                
* Next.
    
* Add a name for the alarm, and an optional description.
    
* Preview the alarm and click **Create alarm**.
    

Then you will be able to see the alarm.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1678197763862/ed35e8f1-2471-414f-9c9e-15e68b20ec94.png align="center")

First in an **Insufficient data** status, then **OK** in a few minutes.

If you click on the alarm name you will be able to see its metrics over time. Keep in mind it is fetching data every 6 hours.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1678197889842/0b885704-dc5a-4da8-a20c-7fc464f8fa60.png align="center")

**FIN!** You now have a reliable alarm checking every 6 hours for your estimated charges.

## Conclusion

Keep in mind the threshold you set for the alarm is a forecast value, based on current and past usage in your account. AWS will calculate this value as an estimation of what could be the final number on your current month's bill.

The actual charge could be way less. To check on the actual vs forecast, please visit your [Billing console](https://console.aws.amazon.com/billing/).

## References

* [Create Billing alarms with CloudWatch](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/monitor_estimated_charges_with_cloudwatch.html) on estimated charges.
    
* [AWS Free Tier](https://aws.amazon.com/free/?all-free-tier.sort-by=item.additionalFields.SortRank&all-free-tier.sort-order=asc&awsf.Free%20Tier%20Types=*all&awsf.Free%20Tier%20Categories=*all).
    

---

Thank you for stopping by! Do you know other ways to do this? Please let me know in the comments, I always like to learn how to do things differently.
