Amazon CloudWatch — One Stop Shop for Monitoring Workloads
Handle events, send notifications, take action.
I’m a big fan of doing the minimum amount of work required to achieve a desired outcome.
To help with that, there is an AWS service called Amazon CloudWatch that is (mostly) free to use that you could get started with today to get the most out of your AWS experience. In a nutshell, the monitoring is free for most services, but the storage of your log files is not free.
I would like to give you an idea to both save you some money, and help you get some hands on experience.
Create billing alerts that notify you, then take action.
When starting out it can be overwhelming with the amount of services available to use. Additionally, many services will bill you for things you had no idea cost money. Did you know that failing to release an elastic IP address will result in ongoing charges?
It’s not your fault though, there’s a lot going on. Lets say you wanted to spend no more than $20 a month on AWS services. Here is something you can do to help meet that goal, and then automate it.
- Login to the AWS console with an account that has sufficient IAM permissions
- Go to the billing console and select billing preferences, select “Receive Billing Alerts”, then Save preferences. Note that once enabled this preference cannot be disabled.
- Navigate to the CloudWatch console, on the left hand column under alarms, go to “All alarms”, then “Create alarm”.
- Choose “select metric”, then select Billing in the browse box. Note that if you don’t see it you may need to change your region to N. Virginia (us-east-1)
- Choose “Total Estimated Charge”, then “EstimatedCharges”, then “Select metric”.
- The rest of your configuration should look as follows
- Choose “Next”, and in the notification section, select “Add Notification” and configure one as follows, using your unique topic name and email, then select “Create topic”.
- AWS will send you a confirmation email (make sure it doesn’t go to your spam or promos folder) that you must confirm.
- Click Next, enter a name and description, preview and create, and finally Create alarm.
And just like that, you will automatically receive an email notification whenever your charges exceed your $20 limit.
To take it a step further, it is possible to configure an Amazon EventBridge (formerly CloudWatch events) event to automatically terminate any resources that are costing you money when you reach your budget limit. However, I think the best way to learn is to try it yourself, so if that is something that you would want to explore, an idea to get you going would be to setup CloudWatch to automatically shut down any EC2 instances you have going so you no longer incur charges for them.
Hopefully this was helpful for you to begin to understand how you can use CloudWatch as a middleman between you and your resources. CloudWatch can work natively with most other AWS services, and also trigger actions based on specified conditions you set.
Feel free to checkout AWS documentation as well as the free training they have out there for you. And as always, best of luck in your continued journey of learning Cloud Computing.